# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
44330 |
2018-03-31T11:39:48 Z |
octopuses |
None (JOI16_memory2) |
C++17 |
|
2 ms |
680 KB |
#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[B[i][0]].push_back(b[i]);
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]) ? 1 : 0;
for(int i = 0; i < 3; ++ i)
if(i != k)
C[A[i][k]].push_back(a[i]);
k = a[k];
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
2 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
488 KB |
Output is correct |
5 |
Correct |
2 ms |
488 KB |
Output is correct |
6 |
Correct |
2 ms |
488 KB |
Output is correct |
7 |
Correct |
2 ms |
488 KB |
Output is correct |
8 |
Correct |
2 ms |
488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
488 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
2 ms |
564 KB |
Output is correct |
7 |
Correct |
2 ms |
572 KB |
Output is correct |
8 |
Correct |
2 ms |
584 KB |
Output is correct |
9 |
Correct |
2 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
640 KB |
Output is correct |
4 |
Correct |
2 ms |
660 KB |
Output is correct |
5 |
Correct |
2 ms |
680 KB |
Output is correct |
6 |
Correct |
2 ms |
680 KB |
Output is correct |
7 |
Correct |
2 ms |
680 KB |
Output is correct |
8 |
Correct |
2 ms |
680 KB |
Output is correct |
9 |
Correct |
2 ms |
680 KB |
Output is correct |
10 |
Correct |
2 ms |
680 KB |
Output is correct |