/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 348.0 KiB
#3 Accepted 1ms 540.0 KiB
#4 Accepted 1ms 488.0 KiB
#5 Accepted 1ms 540.0 KiB
#6 Accepted 1ms 488.0 KiB
#7 Accepted 1ms 540.0 KiB
#8 Accepted 1ms 540.0 KiB
#9 Accepted 1ms 304.0 KiB
#10 Accepted 1ms 540.0 KiB
#11 Accepted 1ms 352.0 KiB

Code

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define IOS  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int M = 3e5 + 5, MOD = 998244353;
int32_t main()
{
    string s = "leadinguniversity";
    int x = s.size();
    sort(s.begin(),s.end());
    string g;
    cin>>g;
    int y = g.size();
    sort(g.begin(),g.end());
    int f = 0;
    if(y == x)
    {
        for(int i = 0;i < x;i++)
        {
            int a = 0;
            int b = 0;
            for(int j = 0;j < x;j++)
            {
                if(s[i] == s[j])
                {

                    a++;
                }
                if(g[i] == g[j])
                {
                    b++;
                }
            }
            if(a != b)
            {
                f = 1;
                cout<<"Impossible"<<endl;
                break;
            }
        }
        if(f == 0)
        {
            cout<<"Leading University";
        }
    }
    else
    {
        cout<<"Impossible";
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1024 Rearrange Character
Contest
Brain booster #2
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-06 14:19:54
Judged At
2024-03-06 14:19:55
Judged By
Score
100
Total Time
1ms
Peak Memory
540.0 KiB