QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#824155#9834. Keyboard Chaosziyistudy#WA 1ms3812kbC++141.1kb2024-12-21 12:42:052024-12-21 12:42:05

Judging History

This is the latest submission verdict.

  • [2024-12-21 12:42:05]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3812kb
  • [2024-12-21 12:42:05]
  • 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;
//	int m=0;
	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<=n;++i) {
		string ans="";
		for(int k=1;k<=e;++k) {
			if(b[1][k]==false) {
				cout<<(char)(k+'a'-1);
				return 0;
			}
		}
		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: 1ms
memory: 3812kb

input:

1 26
win

output:

a

result:

ok Got unprintable string of length 1

Test #2:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

3 3
abc
bca
cab

output:

aa

result:

ok Got unprintable string of length 2

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3656kb

input:

4 2
aab
bb
a
bab

output:

No

result:

wrong answer Line [name=participantAns] equals to "No", doesn't correspond to pattern "(NO|[a-b]+)"