Accepted
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-11-11 03:42:00
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 764.0 KiB