QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#738319 | #855. A Very Different Word | jiangzhihui# | WA | 1ms | 3700kb | C++23 | 766b | 2024-11-12 18:40:54 | 2024-11-12 18:40:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std ;
void solve()
{
int n ;
cin >> n ;
string k ;
cin >> k ;
string s , t ;
cin >> s >> t ;
string ts = s ;
vector<string> ans ;
for(int i = 0 ; i < 26 ; i ++)
{
if(s.size() > 1) s[n - 2] = (char)('a' + i) ;
for(int j = 0 ; j < 26 ; j ++) s[n - 1] = (char)('a' + j) , ans.push_back(s) ;
}
for(auto u : ans)
{
if(count(u.begin() , u.end() , k[0]) > 0 and ts < u and u < t)
{
cout << u << '\n' ;
return ;
}
}
cout << "NO\n" ;
}
int main()
{
std::ios::sync_with_stdio(false) , cin.tie(0) ;
int T ;
cin >> T ;
while (T --) solve() ;
return 0 ;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3700kb
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: -100
Wrong Answer
time: 1ms
memory: 3700kb
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 NO 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 w u NO y t w...
result:
wrong answer Contestant did not find a solution, but jury did.