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 | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
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
Name |
---|
is N >= 1e7 + 1?
N is upto 1e7
In your submission , I can see N = 3e5 + 5
change line 10 : i % 2 -> j % 2
thanks adsjhdhgsdjshdjhd
wtf is thanks for meta facebook