#include "Memory2_lib.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int T, int N)
{
vector < int > C[50];
vector < int > c;
int A[4][4], B[4][4];
int a[4], b[4];
a[0] = 0; a[1] = 1; a[2] = 2;
for(int i = 0; i < 3; ++ i)
for(int j = i + 1; j < 3; ++ j)
A[i][j] = A[j][i] = Flip(i, j);
for(int k = 3; k < N + N; ++ k)
{
b[3] = k;
for(int i = 0; i < 3; ++ i)
{
b[i] = a[i];
B[i][3] = B[3][i] = Flip(b[i], k);
for(int j = 0; j < 3; ++ j)
B[i][j] = A[i][j];
}
for(int i = 0; i < 4; ++ i)
if(i == 0)
B[i][i] = B[i][i + 1];
else
B[i][i] = B[i][i - 1];
for(int i = 0; i < 4; ++ i)
{
bool flag = true;
for(int j = 1; j < 4; ++ j)
if(B[i][j] != B[i][j - 1])
{
flag = false;
break;
}
if(flag)
{
c.clear();
for(int j = 0; j < 4; ++ j)
if(j != i)
c.push_back(j);
break;
}
}
for(int i = 0; i < 3; ++ i)
{
a[i] = b[c[i]];
for(int j = 0; j < 3; ++ j)
A[i][j] = B[c[i]][c[j]];
}
}
int k = (A[0][1] == A[0][2]) ? a[1] : a[0];
for(int i = 0; i < N + N; ++ i)
{
if(i == k)
continue;
int d = Flip(i, k);
C[d].push_back(i);
}
for(int i = 0; i < N; ++ i)
{
if(C[i].size() == 1)
C[i].push_back(k);
Answer(C[i][0], C[i][1], i);
}
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
5 |
Correct |
2 ms |
460 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
2 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
2 ms |
584 KB |
Output is correct |
4 |
Correct |
2 ms |
584 KB |
Output is correct |
5 |
Correct |
2 ms |
584 KB |
Output is correct |
6 |
Correct |
2 ms |
584 KB |
Output is correct |
7 |
Correct |
2 ms |
764 KB |
Output is correct |
8 |
Correct |
2 ms |
764 KB |
Output is correct |
9 |
Correct |
2 ms |
764 KB |
Output is correct |
10 |
Correct |
2 ms |
764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
764 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |