QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#342459 | #4084. 카드 뒤집기 게임 | Unknown1508 | 0 | 22ms | 8296kb | C++20 | 1.3kb | 2024-03-01 11:28:40 | 2024-03-01 11:28:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct DSU {
vector<int> parent;
DSU() {}
DSU(int N): parent(N, -1) {}
int get(int x){
return (parent[x] < 0) ? x : (parent[x] = get(parent[x]));
}
bool merge(int a, int b){
a = get(a); b = get(b);
if (a == b) return false;
if (parent[a] > parent[b]) swap(a, b);
parent[a] += parent[b];
parent[b] = a;
return true;
}
};
bool check(int n, const vector<string> &vec){
int R = vec.size(), C = vec[0].size();
DSU dsu((R + C) * 2);
for (int i = 0; i < R; i++){
for (int j = 0; j < C; j++){
if (vec[i][j] == 'X'){
dsu.merge(R * 2, (C + n) * 2);
dsu.merge(R * 2 + 1, (C + n) * 2 + 1);
}
else{
dsu.merge(R * 2, (C + n) * 2 + 1);
dsu.merge(R * 2 + 1, (C + n) * 2);
}
}
}
for (int i = 0; i < (R + C) * 2; i += 2){
if (dsu.get(i) == dsu.get(i+1)) return false;
}
return true;
}
bool reversal(int n, int m, vector<string> v){
bool valid = true;
for (int a = 0; a < m; a++){
for (int b = 0; b < m; b++){
vector<string> vec;
for (int row = a; row < n; row += m){
vec.emplace_back();
for (int col = b; col < n; col += m){
vec.back().push_back(v[row][col]);
}
}
valid &= check(n, vec);
}
}
return valid;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 11
Accepted
time: 0ms
memory: 3860kb
input:
10 1 OOOOOOOOOX XOXXOOOOOO XOOXOOOXOO OOOOOOOOOO OOOXOOOOOO OOXOOXXOOO OOOOXOOOOO XOOOOOOOXO OOOXXOOOXO OOOOOOOOOO
output:
0
result:
ok single line: '0'
Test #2:
score: -11
Wrong Answer
time: 0ms
memory: 3664kb
input:
10 1 OOOOOOOOXX OOOOOOOOXX XXXXXXXXOO XXXXXXXXOO OOOOOOOOXX OOOOOOOOXX OOOOOOOOXX OOOOOOOOXX OOOOOOOOXX OOOOOOOOXX
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'
Subtask #2:
score: 0
Wrong Answer
Test #46:
score: 50
Accepted
time: 14ms
memory: 8132kb
input:
1000 1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOXOOOOOOXOOOOOOOOOOOOOOOOXOOOOOOXOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOXOOOOO...
output:
0
result:
ok single line: '0'
Test #47:
score: -50
Wrong Answer
time: 14ms
memory: 8296kb
input:
1000 1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOXOOOOOOXOOOOOOOOOOOOOOOOXOOOOOOXOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOXOOOOOO...
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'
Subtask #3:
score: 0
Wrong Answer
Test #66:
score: 39
Accepted
time: 20ms
memory: 8216kb
input:
1000 1 XXOOXXOXXXOOXXOXOXXXXXXXOOXXOXXXXXXXXOXXOXXXXOXXXXOOOOXXOXOOXOXXXXXOXXXXXOOXXXOOOXOXOXXXXXXXXXXXOXOXXOOXXXOOXXXXOOXXOOOXXOXXOXOXOXXXXXOXXXXOXXXOXXOXXXOXXXXXOXXXXXXOOXOXOXOXOXOXOXXXXXXXOXXXXOXXXXXXXXXOOOOOOXXXXOOOOXXXOXXOOXOXXXXXXXXXOXXOOXXXXOXXXXXXXXXOXXXOOXXOOXOOOXXXXOXOXXOXXXXOOXOXXOOXXXXXO...
output:
0
result:
ok single line: '0'
Test #67:
score: 0
Accepted
time: 22ms
memory: 8172kb
input:
1000 1 XXXXXXXXXOOXXXXOXXXXXXXXXXXOXXXXXOOOXXXOXOXXXXXXXXOXXXXOOXOXXOXXXXOOOXXXXXXXXXXOOXOXXXOOXOXXXXXXXXXXOOXXXXXXOXXOOXXXXXOOXXXXXXXXXOXXXXXXXXXXXXOXXXXXXOXXOXXOXXOOXXXXOOXOXOXXXXXXOOXOXOXXXXXOXXOXOXOXOXXOXOXOXXXXXXXOXXOXXXXXXXXXXOXXXXOOXXOXXOXXXXXXXXOXOOXXXOXOOXXXOXXXXXXXXOXXXXXXOXXXXXXOXXXXXOXXO...
output:
0
result:
ok single line: '0'
Test #68:
score: -39
Wrong Answer
time: 16ms
memory: 8164kb
input:
1000 1 OOOOOOOOXXOOOOXOOOOOOOOOOOXOOOOOXXXOOOXOXOOOOOOOOXOOOOXXOXOOXOOOOXXXOOOOOOOOOOXXOXOOOXXOXOOOOOOOOOOXXOOOOOOXOOXXOOOOOXXOOOOOOOOOXOOOOOOOOOOOOXOOOOOOXOOXOOXOOXXOOOOXXOXOXOOOOOOXXOXOXOOOOOXOOXOXOXOXOOXOXOXOOOOOOOXOOXOOOOOOOOOOXOOOOXXOOXOOXOOOOOOOOXOXXOOOXOXXOOOXOOOOOOOOXOOOOOOXOOOOOOXOOOOOXOOXO...
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'