結果
| 問題 |
No.3235 巡回減算
|
| コンテスト | |
| ユーザー |
yu23578
|
| 提出日時 | 2025-08-15 22:09:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 815 bytes |
| コンパイル時間 | 1,787 ms |
| コンパイル使用メモリ | 200,952 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-15 22:10:39 |
| 合計ジャッジ時間 | 12,796 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<int>> A(8,vector<int>(8));
vector<int> now(8);
bool ans = false;
void rotate(){
vector<int> nex(8);
for(int i = 0; i < 8; i++){
nex[i] = now[(i+1)%8];
}
now = nex;
}
void dfs(int depth){
if(depth == 8){
int cnt = 0;
for(int i = 0; i < 8; i++) cnt += now[i];
if(cnt == 0) ans = true;
return;
}
vector<int> mae = now;
for(int i = 0; i <= 8; i++){
for(int j = 0; j < 8; j++) now[j] -= A[depth][j];
dfs(depth+1);
for(int j = 0; j < 8; j++) now[j] += A[depth][j];
rotate();
}
now = mae;
}
signed main(){
for(int i = 0; i < 8; i++){
string S;cin>>S;
for(int j = 0; j < 8; j++){
A[i][j] = S[j] - '0';
}
}
now = A[0];
dfs(1);
ans ? cout << "Yes" << "\n" : cout << "No" << "\n";
}
yu23578