QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#251025 | #855. A Very Different Word | thomas_li# | AC ✓ | 2ms | 3508kb | C++17 | 1.5kb | 2023-11-14 04:26:42 | 2023-11-14 04:26:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define rep(i,a,b) for(int i = a; i < (b); i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back
#define FS first
#define SD second
#define cmx(x,y) x = max(x,y)
#define cmn(x,y) x = min(x,y)
#define ary(k) array<int,k>
typedef pair<int,int> pii;
typedef vector<int> vi;
void zwieksz(string &cel) {
int lit = sz(cel) - 1;
while (cel[lit] == 'z') {
cel[lit] = 'a';
lit--;
}
cel[lit]++;
}
void fun() {
int n;
string s, t, cel;
char k;
cin >> n >> k >> s >> t;
cel = s;
for (int i = 0; i <= 26; i++) {
zwieksz(cel);
if (cel == t) {
break;
}
for (auto c : cel) {
if (c == k) {
cout << cel << "\n";
return;
}
}
}
cout << "NO\n";
//
// cerr << cel << "\n";
// if (cel == t) {
// cout << "NO\n";
// return;
// }
// if (cel[0] == k) {
// cout << cel << "\n";
// return;
// }
// cel = "" + k;
// for (int i = 0; i < n-1; i++) {
// cel += "a";
// }
// if (cel >= t) {
// cout << "NO\n";
// return;
// }
// cout << cel << "\n";
}
signed main(){
cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit);
int t;
cin >> t;
while (t--) fun();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3364kb
input:
4 10 m christmasa christmasx 6 m spring winter 21 a ithinkthereforeisleep ithinkthereforeithink 3 z tcs tcz
output:
christmasb sprinm ithinkthereforeislefa NO
result:
ok OK!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3372kb
input:
149 10 m christmasa christmasx 21 a ithinkthereforeisleep ithinkthereforeithink 3 z tcs tcz 6 m spring winter 8 b aaaaaaaa aaaaaaac 9 l aaabbbccc xxxyyyzzz 14 c abcaxzzzzzzzzz abcayyyyyyyyyy 10 a christmasa christmasx 16 x abcabcxyyyyzlmnt abcabcxyyyyzlmob 11 q qwertyaaaau qwertyaaaba 12 z nomnomnom...
output:
christmasb ithinkthereforeislefa NO sprinm aaaaaaab aaabbbccl abcayaaaaaaaaa christmasb abcabcxyyyyzlmnu qwertyaaaav NO NO NO NO y NO x r v t u x p y k k p w o r f s y f y p NO p g o k y m NO t v r w n o e i o l x q i q o u c NO h n f f j w y s v y h i n NO t s l v m v u r m j t v t h k q x h t x f ...
result:
ok OK!
Test #3:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
308 16 r pppppppppppppppp pppppppppppppppq 183 h yadswtbucvyybqqbzelblcqjxodpsicgtjzagazrnqxycqhadpljbzlneduawfsfxxvoipdafjdpamgeydrjercplbvdbhieiofdgegkgxezghtwwhqzigfjgouvputfkmawngwgvgsknfkgupbwujaielpryeifgfukygdjxmvlkziruxbuxqz yadswtbucvyybqqbzelblcqjxodpsicgtjzagazrnqxycqhadpljbzlneduawfsfxxv...
output:
NO yadswtbucvyybqqbzelblcqjxodpsicgtjzagazrnqxycqhadpljbzlneduawfsfxxvoipdafjdpamgeydrjercplbvdbhieiofdgegkgxezghtwwhqzigfjgouvputfkmawngwgvgsknfkgupbwujaielpryeifgfukygdjxmvlkziruxbuxra rumfusabgtvavyqvmw lxnfntyxjpmtqnqubthagytoddtpqcxlexdtflwzyokizyrcqkpctbjewodyusiiepdvkmjouoajxwvapvtmatbnwbpsqq...
result:
ok OK!
Test #4:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
2534 49 v sttadpsqbqbrttbnnaudjbicnhslcmpgbfphuafaunknstbna sttadpsqbqbrttbnnaudjbicnhslcmpgbfphuafaunknstbnf 31 y jhbujlddqaseoestrlgmcaehcmakfdc jhbujlddqaseoestrlgmcaehcmakfdt 19 w dobmjbrdafhdglecfdf dobmjbrdafhdglecfdi 45 v dufgpssgnuhfehflqrmqpeijaskfsfrfpileifqmbsqia dufgpssgnuhfehflqrmqpeija...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok OK!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
4 25000 h ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
output:
NO zxyyadswtbucvyybqqbzelblcqjxodpsicgtjzagazrnqxycqhadpljbzlneduawfsfxxvoipdafjdpamgeydrjercplbvdbhieiofdgegkgxezghtwwhqzigfjgouvputfkmawngwgvgsknfkgupbwujaielpryeiffukygdjxmvlkziruxbuxqzguhcevzputscajbughtgvtaevoywqbvkmgvtmitzclxnfntyxjpmtqnqubthagyoldfdqtcpsqwchxvlmenxfdstdfvlkwqzsygokkgimzsyprkc...
result:
ok OK!