結果
| 問題 |
No.74 貯金箱の退屈
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-30 00:40:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 708 bytes |
| コンパイル時間 | 1,783 ms |
| コンパイル使用メモリ | 198,216 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-30 00:40:43 |
| 合計ジャッジ時間 | 3,214 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<__int128_t> base;
for(int i=0; i<N; i++){
int d; cin >> d;
__int128_t now = 0;
int one = (i+d)%N,two = ((i-d)%N+N)%N;
now += ((__int128_t)1)<<one;
if(one != two) now += ((__int128_t)1)<<two;
for(auto b : base) now = min(now,now^b);
if(now != 0) base.push_back(now);
}
__int128_t W = 0,p2 = 1;
while(N--){
int w; cin >> w;
if(w == 0) W += p2;
p2 <<= 1;
}
for(auto b : base) W = min(W,W^b);
if(W == 0) cout << "Yes\n";
else cout << "No\n";
}