My code snippet
Whats wrong, its giving WA on testcase 3, 140th value differs found BOB correct Alice.
I'm struggling for 10 hours with this
UPD: haha what a funny bug. Thanks to WhisperingWillow
# | User | Rating |
---|---|---|
1 | tourist | 3947 |
2 | jiangly | 3740 |
3 | Radewoosh | 3652 |
4 | Benq | 3626 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3612 |
7 | ecnerwala | 3587 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | ksun48 | 3485 |
# | User | Contrib. |
---|---|---|
1 | awoo | 163 |
2 | maomao90 | 160 |
3 | adamant | 156 |
4 | atcoder_official | 155 |
5 | nor | 154 |
6 | cry | 153 |
7 | -is-this-fft- | 152 |
8 | maroonrk | 151 |
9 | SecondThread | 148 |
10 | Petr | 146 |
Whats; wrong with my grundy numbers
int g[N];
int val = 1;
int vis[N];
void cal(){
for(int i=3;i<N;i+=2){
if(!vis[i]){
vis[i] = 1;
g[i] = ++val;
for(ll j = 1LL*i*i;j<N;j+=i){
if(i%2&&!vis[j]) {
g[j] = val; vis[j]=1;
}
}
}
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int t; cin>>t;
g[1] = 1;
cal();
while(t--){
int n; cin>>n;
vector<int>v(n);
for(int i=0;i<n;i++) cin>>v[i];
int res = 0;
for(int i=0;i<n;i++) res^=g[v[i]];
if(res) cout<<"Alice"<<'\n';
else cout<<"Bob"<<'\n';
}
}
Whats wrong, its giving WA on testcase 3, 140th value differs found BOB correct Alice.
I'm struggling for 10 hours with this
UPD: haha what a funny bug. Thanks to WhisperingWillow
Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|
en2 |
![]() |
StellarSpecter | 2024-08-17 03:59:33 | 80 | Tiny change: ' with this' -> ' with this\n\n\n\nUPD: Thanks to [user:WhisperingWillow]' | |
en1 |
![]() |
StellarSpecter | 2024-08-17 03:42:28 | 948 | Initial revision (published) |
Name |
---|