QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#64927 | #4237. Word Ladder | triplem5ds# | AC ✓ | 61ms | 3704kb | C++23 | 1.6kb | 2022-11-25 21:44:43 | 2022-11-25 21:44:44 |
Judging History
answer
/// Brrrr Brrrr
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x,y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll
using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;
const int N = 1e6+5, LG = 18, MOD = (119 << 23) + 1;
const long double PI = acos(-1);
const long double EPS = 1e-7;
const int dx[] = {0,0,1,-1};
const int dy[] = {1,-1,0,0};
void doWork() {
mt19937 mrand(time(0));
int n;
cin >> n;
vector<string> vs;
vs.push_back(string(10, 'a'));
f(i,1,n) {
vs.push_back("");
while(true) {
vs[i] = vs[i-1];
vs[i][mrand()%10] = 'a' +mrand()%26;
bool ok = true;
f(j,0,i-1) {
int cnt = 0;
f(k,0,10) cnt += vs[i][k]!=vs[j][k];
if(cnt==1) {
ok=false;
break;
}
}
if(ok) {
break;
}
}
}
for(auto x : vs)
cout << x << '\n';
}
int32_t main() {
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
int t = 1;
// cin >> t;
while (t--) {
doWork();
}
return 0;
}
///Look at my code ya codeomk
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3468kb
input:
5
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa
result:
ok good solution
Test #2:
score: 0
Accepted
time: 3ms
memory: 3444kb
input:
3
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa
result:
ok good solution
Test #3:
score: 0
Accepted
time: 2ms
memory: 3400kb
input:
4
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa
result:
ok good solution
Test #4:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
6
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa
result:
ok good solution
Test #5:
score: 0
Accepted
time: 3ms
memory: 3444kb
input:
7
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa
result:
ok good solution
Test #6:
score: 0
Accepted
time: 2ms
memory: 3516kb
input:
8
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa
result:
ok good solution
Test #7:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
9
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa
result:
ok good solution
Test #8:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
10
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa
result:
ok good solution
Test #9:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
64
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #10:
score: 0
Accepted
time: 2ms
memory: 3588kb
input:
51
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #11:
score: 0
Accepted
time: 2ms
memory: 3436kb
input:
97
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #12:
score: 0
Accepted
time: 2ms
memory: 3496kb
input:
100
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #13:
score: 0
Accepted
time: 4ms
memory: 3504kb
input:
1000
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #14:
score: 0
Accepted
time: 4ms
memory: 3576kb
input:
1001
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #15:
score: 0
Accepted
time: 4ms
memory: 3576kb
input:
1024
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #16:
score: 0
Accepted
time: 5ms
memory: 3632kb
input:
1025
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #17:
score: 0
Accepted
time: 56ms
memory: 3704kb
input:
5000
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #18:
score: 0
Accepted
time: 61ms
memory: 3700kb
input:
4999
output:
aaaaaaaaaa aaaaafaaaa aaaahfaaaa aaaahfapaa aaaahfjpaa alaahfjpaa alanhfjpaa alanhkjpaa alanhkrpaa aldnhkrpaa zldnhkrpaa zjdnhkrpaa zjwnhkrpaa mjwnhkrpaa mjwnikrpaa mjznikrpaa mjznikrpga mjynikrpga mjyniwrpga mjyniwrpna mjynisrpna mjynisrpnb mjyhisrpnb cjyhisrpnb cjyhismpnb cjyhysmpnb cjyzysmpnb cjy...
result:
ok good solution
Test #19:
score: 0
Accepted
time: 39ms
memory: 3648kb
input:
4096
output:
aaaaaaaaaa faaaaaaaaa faaaaaasaa falaaaasaa falaaaasfa faltaaasfa fmltaaasfa fmltjaasfa fmltjadsfa fmltjadrfa faltjadrfa faltjaarfa faltiaarfa faztiaarfa faztiasrfa fazgiasrfa fazgiasrfc fazgixsrfc oazgixsrfc oazginsrfc oazgxnsrfc oazgxnsyfc oazgtnsyfc oazgtnyyfc oazgtnyyfu omzgtnyyfu omzgfnyyfu omz...
result:
ok good solution
Test #20:
score: 0
Accepted
time: 42ms
memory: 3604kb
input:
4097
output:
aaaaaaaaaa faaaaaaaaa faaaaaasaa falaaaasaa falaaaasfa faltaaasfa fmltaaasfa fmltjaasfa fmltjadsfa fmltjadrfa faltjadrfa faltjaarfa faltiaarfa faztiaarfa faztiasrfa fazgiasrfa fazgiasrfc fazgixsrfc oazgixsrfc oazginsrfc oazgxnsrfc oazgxnsyfc oazgtnsyfc oazgtnyyfc oazgtnyyfu omzgtnyyfu omzgfnyyfu omz...
result:
ok good solution
Test #21:
score: 0
Accepted
time: 39ms
memory: 3544kb
input:
4098
output:
aaaaaaaaaa faaaaaaaaa faaaaaasaa falaaaasaa falaaaasfa faltaaasfa fmltaaasfa fmltjaasfa fmltjadsfa fmltjadrfa faltjadrfa faltjaarfa faltiaarfa faztiaarfa faztiasrfa fazgiasrfa fazgiasrfc fazgixsrfc oazgixsrfc oazginsrfc oazgxnsrfc oazgxnsyfc oazgtnsyfc oazgtnyyfc oazgtnyyfu omzgtnyyfu omzgfnyyfu omz...
result:
ok good solution
Test #22:
score: 0
Accepted
time: 36ms
memory: 3644kb
input:
3751
output:
aaaaaaaaaa faaaaaaaaa faaaaaasaa falaaaasaa falaaaasfa faltaaasfa fmltaaasfa fmltjaasfa fmltjadsfa fmltjadrfa faltjadrfa faltjaarfa faltiaarfa faztiaarfa faztiasrfa fazgiasrfa fazgiasrfc fazgixsrfc oazgixsrfc oazginsrfc oazgxnsrfc oazgxnsyfc oazgtnsyfc oazgtnyyfc oazgtnyyfu omzgtnyyfu omzgfnyyfu omz...
result:
ok good solution