QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#444413 | #8646. Card Collection | arbuzick# | 0 | 0ms | 3500kb | C++20 | 2.3kb | 2024-06-15 18:56:36 | 2024-06-15 18:56:36 |
answer
#include <bits/stdc++.h>
using namespace std;
set<vector<vector<int>>> st;
void gen(vector<vector<int>> nw) {
if (st.count(nw)) {
return;
}
st.insert(nw);
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
if (nw[i][j]) {
for (int i2 = 0; i2 < 3; ++i2) {
for (int j2 = 0; j2 < 3; ++j2) {
if (nw[i2][j2]) {
if (i != i2 || j != j2 || nw[i][j] > 1) {
nw[i][j]--;
nw[i2][j2]--;
nw[min(i, i2)][min(j, j2)]++;
gen(nw);
nw[min(i, i2)][min(j, j2)]--;
nw[max(i, i2)][max(j, j2)]++;
gen(nw);
nw[max(i, i2)][max(j, j2)]--;
nw[i2][j2]++;
nw[i][j]++;
}
}
}
}
}
}
}
}
void solve() {
int n, m;
vector<int> s(n), v(n);
for (int i = 0; i < n; ++i) {
cin >> s[i] >> v[i];
}
int pos = 0;
while (m--) {
pos++;
int t, w;
cin >> t >> w;
vector<vector<int>> cnt(3, vector<int>(3));
for (int i = 0; i < n; ++i) {
int t1, t2;
if (s[i] < t) {
t1 = 0;
} else if (s[i] == t) {
t1 = 1;
} else {
t1 = 2;
}
if (v[i] < w) {
t2 = 0;
} else if (v[i] == w) {
t2 = 1;
} else {
t2 = 2;
}
cnt[t1][t2]++;
}
st.clear();
gen(cnt);
vector<vector<int>> ans(3, vector<int>(3));
ans[1][1] = 1;
if (st.count(ans)) {
cout << pos << ' ';
}
}
cout << '\n';
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3500kb
input:
2 10 171631799 561094698 171631799 867698918 126573648 561094698 171631799 867698918 171631799 561094698 126573648 561094698 126573648 561094698 171631799 561094698 126573648 561094698 126573648 561094698 126573648 561094698 171631799 561094698
output:
result:
wrong answer Answer contains longer sequence [length = 4], but output contains 0 elements
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%