結果

問題 No.1665 quotient replace
ユーザー kabipoyokabipoyo
提出日時 2022-01-04 03:56:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 572 ms / 3,000 ms
コード長 1,774 bytes
コンパイル時間 9,168 ms
コンパイル使用メモリ 255,584 KB
実行使用メモリ 26,880 KB
最終ジャッジ日時 2024-04-21 18:48:29
合計ジャッジ時間 15,288 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
11,136 KB
testcase_01 AC 13 ms
11,136 KB
testcase_02 AC 15 ms
11,136 KB
testcase_03 AC 13 ms
11,136 KB
testcase_04 AC 13 ms
11,136 KB
testcase_05 AC 15 ms
11,056 KB
testcase_06 AC 19 ms
11,392 KB
testcase_07 AC 13 ms
11,136 KB
testcase_08 AC 15 ms
11,264 KB
testcase_09 AC 30 ms
11,520 KB
testcase_10 AC 197 ms
16,368 KB
testcase_11 AC 430 ms
22,912 KB
testcase_12 AC 57 ms
12,416 KB
testcase_13 AC 538 ms
26,752 KB
testcase_14 AC 543 ms
26,624 KB
testcase_15 AC 543 ms
26,880 KB
testcase_16 AC 567 ms
26,752 KB
testcase_17 AC 572 ms
26,752 KB
testcase_18 AC 13 ms
11,136 KB
testcase_19 AC 13 ms
11,008 KB
testcase_20 AC 13 ms
11,008 KB
testcase_21 AC 13 ms
11,008 KB
testcase_22 AC 15 ms
11,216 KB
testcase_23 AC 13 ms
10,996 KB
testcase_24 AC 14 ms
11,132 KB
testcase_25 AC 14 ms
11,136 KB
testcase_26 AC 14 ms
11,108 KB
testcase_27 AC 18 ms
11,260 KB
testcase_28 AC 27 ms
11,684 KB
testcase_29 AC 39 ms
12,404 KB
testcase_30 AC 216 ms
19,200 KB
testcase_31 AC 320 ms
23,196 KB
testcase_32 AC 421 ms
22,528 KB
testcase_33 AC 168 ms
15,320 KB
testcase_34 AC 338 ms
20,224 KB
testcase_35 AC 323 ms
19,456 KB
testcase_36 AC 324 ms
19,844 KB
testcase_37 AC 311 ms
18,944 KB
testcase_38 AC 371 ms
20,608 KB
testcase_39 AC 242 ms
17,664 KB
testcase_40 AC 251 ms
17,664 KB
testcase_41 AC 265 ms
17,792 KB
testcase_42 AC 13 ms
11,008 KB
testcase_43 AC 14 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef int64_t lint;
#define rep(i, n) for(int i=0; i<n; i++)
#define repx(i, l, n) for(int i=l; i<n; i++)
#define all(v) v.begin(), v.end()
#define show(x) cout << #x << ": " << x << endl;
#define list(x) cout << #x << ": " << x << "  ";
#define pb push_back
using vi = vector<lint>;
using vvi = vector<vector<lint>>;
template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline void drop(T x) { cout << x << endl; exit(0); }
template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; }
constexpr lint LINF = LLONG_MAX/2;
struct Sieve {
	int n;
	vector<lint> p;
	Sieve(int n=1):n(n), p(n+1) {
		p.at(0) = -1, p.at(1) = -1;
		for(lint i=2; i<=n; i++) {
			if(!p.at(i)) {
				p.at(i) = i;
				for(lint j=i*i; j<=n; j+=i) {
					if (!p.at(j)) p.at(j) = i;
				}
			}
		}
	}
	bool isPrime(int x) { return p.at(x) == x;}
	vector<lint> factorList(int x) {
		vector<lint> v;
		while (x != 1) {
			v.push_back(p.at(x));
			x /= p.at(x);
		}
		return v;
	}
	vector<lint> factor(int x) {
		vector<lint> v;
		while (x != 1) {
			int t = p.at(x);
			v.push_back(t);
			while (x % t == 0) x /= t;
		}
		return v;
	}
};

int main() {
	lint N;
	cin >> N;
	vi v(N), w(N);
	vin(v);

	lint a=0, b=0, c=0, x, y, z;
	Sieve S(1001001);
	rep(i, N) {
		if (v[i] == 1) continue;
		w[i] = S.factorList(v[i]).size();
	}
	rep(i, N) {
		a ^= w[i];
	}
	if (!a) std::cout << "black" << '\n';
	else std::cout << "white" << '\n';
}
0