結果

問題 No.1665 quotient replace
ユーザー 👑 kmjpkmjp
提出日時 2021-09-03 22:44:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 3,000 ms
コード長 1,151 bytes
コンパイル時間 2,002 ms
コンパイル使用メモリ 200,160 KB
実行使用メモリ 15,188 KB
最終ジャッジ日時 2023-08-21 23:46:24
合計ジャッジ時間 7,890 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
11,512 KB
testcase_01 AC 43 ms
11,564 KB
testcase_02 AC 43 ms
11,512 KB
testcase_03 AC 43 ms
11,504 KB
testcase_04 AC 44 ms
11,792 KB
testcase_05 AC 43 ms
11,532 KB
testcase_06 AC 44 ms
11,504 KB
testcase_07 AC 43 ms
11,552 KB
testcase_08 AC 43 ms
11,500 KB
testcase_09 AC 47 ms
11,524 KB
testcase_10 AC 81 ms
13,612 KB
testcase_11 AC 134 ms
14,196 KB
testcase_12 AC 56 ms
13,660 KB
testcase_13 AC 161 ms
15,124 KB
testcase_14 AC 151 ms
15,148 KB
testcase_15 AC 150 ms
15,188 KB
testcase_16 AC 154 ms
15,164 KB
testcase_17 AC 157 ms
15,148 KB
testcase_18 AC 43 ms
11,640 KB
testcase_19 AC 43 ms
11,508 KB
testcase_20 AC 43 ms
11,672 KB
testcase_21 AC 44 ms
11,568 KB
testcase_22 AC 44 ms
11,632 KB
testcase_23 AC 44 ms
11,552 KB
testcase_24 AC 44 ms
11,788 KB
testcase_25 AC 44 ms
11,560 KB
testcase_26 AC 45 ms
11,504 KB
testcase_27 AC 45 ms
11,612 KB
testcase_28 AC 48 ms
11,556 KB
testcase_29 AC 53 ms
11,608 KB
testcase_30 AC 97 ms
13,560 KB
testcase_31 AC 125 ms
14,272 KB
testcase_32 AC 128 ms
14,112 KB
testcase_33 AC 77 ms
13,600 KB
testcase_34 AC 109 ms
13,616 KB
testcase_35 AC 106 ms
13,560 KB
testcase_36 AC 109 ms
13,768 KB
testcase_37 AC 101 ms
13,616 KB
testcase_38 AC 122 ms
13,616 KB
testcase_39 AC 95 ms
13,556 KB
testcase_40 AC 98 ms
13,576 KB
testcase_41 AC 91 ms
13,656 KB
testcase_42 AC 43 ms
11,504 KB
testcase_43 AC 43 ms
11,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N;
int A[1010101];

int mask[1010101];
int G[1010101];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	for(i=1;i<=1000000;i++) {
		while(mask[i]&(1<<G[i])) G[i]++;
		for(j=i*2;j<=1000000;j+=i) mask[j] |= 1<<G[i];
	}
	
	cin>>N;
	int nim=0;
	FOR(i,N) {
		cin>>A[i];
		nim^=G[A[i]];
	}
	if(nim==0) cout<<"black"<<endl;
	else cout<<"white"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0