結果

問題 No.1665 quotient replace
コンテスト
ユーザー chocorusk
提出日時 2021-09-03 21:52:34
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1,684 ms / 3,000 ms
コード長 1,445 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,607 ms
コンパイル使用メモリ 196,592 KB
実行使用メモリ 224,512 KB
最終ジャッジ日時 2026-06-22 23:46:44
合計ジャッジ時間 70,915 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:61:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   61 |         scanf("%d", &a);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #
raw source code

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
// using mint=modint998244353;
// mint f[2000010], invf[2000010];
// void fac(int n){
//     f[0]=1;
//     for(ll i=1; i<=n; i++) f[i]=f[i-1]*i;
//     invf[n]=f[n].inv();
//     for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1);
// }
// mint comb(int x, int y){
//     if(!(0<=y && y<=x)) return 0;
//     return f[x]*invf[y]*invf[x-y];
// }
set<int> st[1000010];
int g[1000010];
int main()
{
    for(int d=1; d<=1000000; d++){
        for(int i=0; ; i++){
            if(st[d].find(i)==st[d].end()){
                g[d]=i;break;
            }
        }
        for(int i=2*d; i<=1000000; i+=d){
            st[i].insert(g[d]);
        }
    }
    int n; cin>>n;
    int s=0;
    for(int i=0; i<n; i++){
        int a;
        scanf("%d", &a);
        s^=g[a];
    }
    if(s) cout<<"white"<<endl;
    else cout<<"black"<<endl;
    return 0;
}
0