# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
464802 |
2021-08-14T07:39:58 Z |
tjd229 |
None (JOI16_memory2) |
C++14 |
|
1 ms |
288 KB |
#include "Memory2_lib.h"
#include <vector>
#define pii pair<int,int>
using namespace std;
vector<pii > v[50];
void Solve(int T, int N){
int NN = N + N;
for (int i = 0; i < NN; i += 2) {
v[Flip(i, i + 1)].push_back({i,i+1});
}
for (int find = 0; find < N; ++find) {
bool deg=1;
for (int i = 0; deg &&i < N; ++i) {
if (v[i].size() == 2) {
deg = 0;
int a = v[i].back().first, b = v[i].back().second;
v[i].pop_back();
int c = v[i].back().first, d = v[i].back().second;
v[i].pop_back();
int ac = Flip(a, c), bd = Flip(b, d);
if (ac == i && bd != i);
else if (ac != i && bd == i) {
a ^= b ^= a ^= b;
c ^= d ^= c ^= d;
}
else {
c ^= d ^= c ^= d;
ac = Flip(a, c), bd = Flip(b, d);
if (ac != i && bd == i) {
a ^= b ^= a ^= b;
c ^= d ^= c ^= d;
}
}
Answer(a,c,i);
v[Flip(b, d)].push_back({b,d});
}
}
//deg
if (deg) {
for (int i = 0; i < N; ++i) {
for (auto p : v[i])
Answer(p.first, p.second, i);
}
find = N;
}
}
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
284 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
288 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
288 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
288 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |