QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#824163#9834. Keyboard Chaosziyistudy#WA 0ms3612kbC++141.1kb2024-12-21 12:45:172024-12-21 12:45:19

Judging History

This is the latest submission verdict.

  • [2024-12-21 12:45:19]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3612kb
  • [2024-12-21 12:45:17]
  • Submitted

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";
}

詳細信息

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