# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1052829 |
2024-08-11T03:34:49 Z |
juicy |
None (JOI16_memory2) |
C++17 |
|
1 ms |
348 KB |
#include "Memory2_lib.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int T, int N){
vector<int> cands = {0, 1, 2}, 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 < cands.size(); ++i) {
int x = flip(cands[i], cands[i == 0]);
bool flg = 1;
for (int j = 0; j < cands.size(); ++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 = 3; i < 2 * N; ++i) {
cands.push_back(i);
extract();
}
if (N > 1) {
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]);
}
}
}
}
Compilation message
memory2.cpp: In lambda function:
memory2.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for (int i = 0; i < cands.size(); ++i) {
| ~~^~~~~~~~~~~~~~
memory2.cpp:20:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
20 | for (int j = 0; j < cands.size(); ++j) {
| ~~^~~~~~~~~~~~~~
# |
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 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 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 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |