結果
問題 | No.1665 quotient replace |
ユーザー |
![]() |
提出日時 | 2021-08-09 21:05:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 401 ms / 3,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 1,557 ms |
コンパイル使用メモリ | 170,088 KB |
実行使用メモリ | 14,996 KB |
最終ジャッジ日時 | 2024-12-15 08:47:19 |
合計ジャッジ時間 | 10,580 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){int n; cin >> n;vector<int> a(n);for(int i = 0; i < n; i++) cin >> a[i];vector<int> spl(1000001, 0);spl[1] = 1;for(int i = 2; i <= 1000000; i++){if(spl[i]) continue;for(int j = i; j <= 1000000; j += i){spl[j] = i;}}vector<int> grundy(n);for(int i = 0; i < n; i++){while(a[i] > 1){a[i] /= spl[a[i]];grundy[i]++;}}// all xorint nimber = 0;for(int i = 0; i < n; i++){nimber = nimber ^ grundy[i];}cout << (nimber ? "white" : "black") << endl;}