結果
問題 |
No.1665 quotient replace
|
ユーザー |
![]() |
提出日時 | 2021-12-06 15:52:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 782 bytes |
コンパイル時間 | 1,395 ms |
コンパイル使用メモリ | 174,808 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-07-07 09:19:31 |
合計ジャッジ時間 | 12,572 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int,int>; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main(){ int MAX_N = 1001001; vector<bool> PNJudge(MAX_N,true); set<int> pn; PNJudge[1] = false; for(int i=2;i<MAX_N;i++){ if(!PNJudge[i]) continue; pn.insert(i); for(int j=i*2;j<MAX_N;j+=i) PNJudge[j] = false; } int n; cin >> n; int pncnt = 0, compcnt = 0; rep(i,n){ int a; cin >> a; if(pn.count(a)) pncnt++; else if(a!=1) compcnt++; } bool ans; if(compcnt) ans = (compcnt & 1); else ans = (pncnt & 1); if(ans) cout << "white" << endl; else cout << "black" << endl; return 0; }