# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
26146 |
2017-06-28T06:11:02 Z |
윤교준(#1099) |
None (JOI16_memory2) |
C++11 |
|
0 ms |
2068 KB |
#include "Memory2_lib.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <tuple>
#define rf(x) (x)=0;while(*p<48)im=*p=='-';while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);if(im)(x)=-(x);
#define pb push_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[(sz(V)-2)])
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (1100000099)
#define INFLL (1100000000000000099ll)
#define MAXN (105)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
int d[MAXN][MAXN];
int Ans[MAXN];
vector<int> AnsV[MAXN];
vector<int> V;
int BI = -1;
int f(int a, int b) {
if(a > b) swap(a, b);
if(-1 != d[a][b]) return d[a][b];
return d[a][b] = Flip(a, b);
}
void Solve(int T, int N) {
if(1 == N) { Answer(0, 1, 1); return; }
for(int i = 0; i < MAXN; i++) fill(d[i], d[i]+MAXN, -1);
V.pb(0); V.pb(1); V.pb(2);
for(int i = 3; i < 2*N; i++) {
V.pb(i);
for(int j = 0; j < 4; j++) {
vector<int> A;
for(int k = 0; k < 4; k++) {
if(j == k) continue;
A.pb(f(V[j], V[k]));
}
if(A[0] == A[1] && A[1] == A[2]) {
clv(A); for(int k = 0; k < 4; k++) {
if(j == k) continue;
A.pb(V[k]);
}
swap(V, A);
break;
}
}
}
if(f(V[0], V[1]) == f(V[0], V[2])) { BI = V[1]; Ans[BI] = f(V[1], V[2]); }
else if(f(V[0], V[1]) == f(V[1], V[2])) { BI = V[0]; Ans[BI] = f(V[0], V[2]); }
else if(f(V[2], V[0]) == f(V[2], V[1])) { BI = V[0]; Ans[BI] = f(V[0], V[1]); }
for(int i = 2*N-1; ~i; i--) {
if(BI == i) continue;
Ans[i] = f(i, BI);
}
for(int i = 0; i < 2*N; i++) AnsV[Ans[i]].pb(i);
for(int i = 0; i < N; i++) Answer(AnsV[i][0], AnsV[i][1], i);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2068 KB |
Output is correct |
2 |
Correct |
0 ms |
2068 KB |
Output is correct |
3 |
Correct |
0 ms |
2068 KB |
Output is correct |
4 |
Correct |
0 ms |
2068 KB |
Output is correct |
5 |
Correct |
0 ms |
2068 KB |
Output is correct |
6 |
Correct |
0 ms |
2068 KB |
Output is correct |
7 |
Correct |
0 ms |
2068 KB |
Output is correct |
8 |
Correct |
0 ms |
2068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2068 KB |
Output is correct |
2 |
Correct |
0 ms |
2068 KB |
Output is correct |
3 |
Correct |
0 ms |
2068 KB |
Output is correct |
4 |
Correct |
0 ms |
2068 KB |
Output is correct |
5 |
Correct |
0 ms |
2068 KB |
Output is correct |
6 |
Correct |
0 ms |
2068 KB |
Output is correct |
7 |
Correct |
0 ms |
2068 KB |
Output is correct |
8 |
Correct |
0 ms |
2068 KB |
Output is correct |
9 |
Correct |
0 ms |
2068 KB |
Output is correct |
10 |
Correct |
0 ms |
2068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2068 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |