QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#824163 | #9834. Keyboard Chaos | ziyistudy# | WA | 0ms | 3612kb | C++14 | 1.1kb | 2024-12-21 12:45:17 | 2024-12-21 12:45:19 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll MOD=1e9+7;
// head
const int N=110;
int b[15][30];
struct Node
{
string str;
} a[N];
signed main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,e; cin>>n>>e;
for(int i=1;i<=n;++i) {
cin>>a[i].str;
for(int j=0;a[i].str[j];++j)
b[j][a[i].str[j]-'a'+1]++;
}
for(int i=1;i<=e;++i) {
if(b[1][i]==false) {
cout<<(char)('a'+i-1);
return 0;
}
}
for(int i=1;i<=n;++i) {
string ans="";
for(int j=0;a[i].str[j];++j)
b[j][a[i].str[j]-'a'+1]--;
ans+=(char)a[i].str[0];
for(int j=1;a[i].str[j];++j) {
for(int k=1;k<=e;++k) {
if(b[j-1][k]==false) {
ans+=(char)(k+'a'-1);
cout<<ans;
return 0;
}
}
ans+=(char)a[i].str[j];
}
for(int j=0;a[i].str[j];++j)
b[j][a[i].str[j]-'a'+1]++;
}
cout<<"NO\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
1 26 win
output:
a
result:
ok Got unprintable string of length 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
3 3 abc bca cab
output:
aa
result:
ok Got unprintable string of length 2
Test #3:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
4 2 aab bb a bab
output:
NO
result:
ok ok, can print any string
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
7 3 c ba acc bcb ab bac ac
output:
NO
result:
wrong answer Participant says any string can be printed, but aaaa can't