結果
| 問題 |
No.1665 quotient replace
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2023-06-07 02:14:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2,171 ms / 3,000 ms |
| コード長 | 806 bytes |
| コンパイル時間 | 5,748 ms |
| コンパイル使用メモリ | 110,028 KB |
| 最終ジャッジ日時 | 2025-02-13 23:12:42 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
using namespace std;
using ll = long long;
vector<vector<ll>> fac(1e6+1);
vector<ll> ans(1e6+1, -1);
ll f(ll N){
if (N == 1) return 0;
if (ans[N] != -1) return ans[N];
vector<ll> ok(500);
for (auto x : fac[N]) ok[f(x)] = 1;
ll g = 0;
while(ok[g]) g++;
return ans[N] = g;
}
int main(){
ll N, g=0, A;
cin >> N;
for (int i=1; i<=1e6; i++){
for (int j=i*2; j<=1e6; j+=i) fac[j].push_back(i);
}
for (int i=0; i<N; i++){
cin >> A;
g ^= f(A);
}
cout << (g == 0 ? "black" : "white") << endl;
return 0;
}
srjywrdnprkt