# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1052827 |
2024-08-11T03:03:45 Z |
juicy |
None (JOI16_memory2) |
C++17 |
|
1 ms |
600 KB |
#include "Memory2_lib.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int T, int N){
vector<int> cands = {0, 1}, res(2 * N);
vector his(2 * N, vector<int>(2 * N, -1));
auto flip = [&](int i, int j) {
if (his[i][j] != -1) {
return his[i][j];
}
return his[i][j] = his[j][i] = Flip(i, j);
};
auto extract = [&]() {
for (int i = 0; i < 3; ++i) {
int x = flip(cands[i], cands[i == 0]);
bool flg = 1;
for (int j = 0; j < 3; ++j) {
if (i ^ j) {
flg &= x == flip(cands[i], cands[j]);
}
}
if (flg) {
res[cands[i]] = x;
swap(cands[i], cands.back());
break;
}
}
cands.pop_back();
};
for (int i = 2; i < 2 * N; ++i) {
cands.push_back(i);
extract();
}
res[cands[0]] = res[cands[1]] = flip(cands[0], cands[1]);
for (int i = 0; i < 2 * N; ++i) {
for (int j = i + 1; j < 2 * N; ++j) {
if (res[i] == res[j]) {
Answer(i, j, res[i]);
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Wrong Answer[3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong Answer[3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
436 KB |
Wrong Answer[3] |
6 |
Halted |
0 ms |
0 KB |
- |