답안 #26158

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
26158 2017-06-28T07:05:23 Z 김현수(#1096) Memory 2 (JOI16_memory2) C++
100 / 100
0 ms 2024 KB
#include "Memory2_lib.h"
#include<bits/stdc++.h>
using namespace std;

vector<int> a[55];

void Solve(int _, int N) {
	int P = 0;
	for(int i=1;i<2*N;i++) {
		int T = Flip(P, i);
		a[T].push_back(i);
		if(a[T].size() >= 3) {
			int A = a[T][0], B = a[T][1], C = a[T][2];
			a[T].clear(); a[T].push_back(P);
			int R1 = Flip(A, B), R2 = Flip(A, C);
			if(R1 == T) {
				int X = (R2==T?A:B); P = A+B-X;
				a[T].push_back(X);
				a[Flip(P, C)].push_back(C);
			}
			else {
				P = A;
				a[R1].push_back(B);
				a[R2].push_back(C);
			}
		}
	}
	for(int i=0;i<N;i++) {
		if(a[i].size() == 1) a[i].push_back(P);
		Answer(a[i][0], a[i][1], i);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2024 KB Output is correct
2 Correct 0 ms 2024 KB Output is correct
3 Correct 0 ms 2024 KB Output is correct
4 Correct 0 ms 2024 KB Output is correct
5 Correct 0 ms 2024 KB Output is correct
6 Correct 0 ms 2024 KB Output is correct
7 Correct 0 ms 2024 KB Output is correct
8 Correct 0 ms 2024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2024 KB Output is correct
2 Correct 0 ms 2024 KB Output is correct
3 Correct 0 ms 2024 KB Output is correct
4 Correct 0 ms 2024 KB Output is correct
5 Correct 0 ms 2024 KB Output is correct
6 Correct 0 ms 2024 KB Output is correct
7 Correct 0 ms 2024 KB Output is correct
8 Correct 0 ms 2024 KB Output is correct
9 Correct 0 ms 2024 KB Output is correct
10 Correct 0 ms 2024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2024 KB Output is correct
2 Correct 0 ms 2024 KB Output is correct
3 Correct 0 ms 2024 KB Output is correct
4 Correct 0 ms 2024 KB Output is correct
5 Correct 0 ms 2024 KB Output is correct
6 Correct 0 ms 2024 KB Output is correct
7 Correct 0 ms 2024 KB Output is correct
8 Correct 0 ms 2024 KB Output is correct
9 Correct 0 ms 2024 KB Output is correct
10 Correct 0 ms 2024 KB Output is correct