Submission #26156

# Submission time Handle Problem Language Result Execution time Memory
26156 2017-06-28T07:02:32 Z 김동현(#1095) None (JOI16_memory2) C++14
100 / 100
0 ms 1180 KB
#include "Memory2_lib.h"
#include <vector>
#include <cstdio>
using namespace std;

static int chk[100], cnt[50], a[101];
static vector<int> ans[51];

void Solve(int T, int N){
	a[2 * N] = N;
	for(int i = 0, j; i < 2 * N; i++){
		if(chk[i]) continue;
		fill(cnt, cnt + N, 0);
		for(j = i + 1; j < 2 * N; j++){
			if(chk[j]) continue;
			a[j] = Flip(i, j);
			cnt[a[j]]++;
			if(cnt[a[j]] > 2 - int(ans[a[j]].size())) break;
		}
		ans[a[j]].push_back(i);
		for(int k = i + 1; k < j; k++){
			if(chk[k]) continue;
			if(a[k] != a[j]){
				ans[a[k]].push_back(k);
				chk[k] = 1;
			}
		}
	}
	for(int i = 0; i < N; i++) if(ans[i].size() < 2) ans[i].push_back(ans[N][0]);
	for(int i = 0; i < N; i++) Answer(ans[i][0], ans[i][1], i);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
6 Correct 0 ms 1180 KB Output is correct
7 Correct 0 ms 1180 KB Output is correct
8 Correct 0 ms 1180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
6 Correct 0 ms 1180 KB Output is correct
7 Correct 0 ms 1180 KB Output is correct
8 Correct 0 ms 1180 KB Output is correct
9 Correct 0 ms 1180 KB Output is correct
10 Correct 0 ms 1180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
6 Correct 0 ms 1180 KB Output is correct
7 Correct 0 ms 1180 KB Output is correct
8 Correct 0 ms 1180 KB Output is correct
9 Correct 0 ms 1180 KB Output is correct
10 Correct 0 ms 1180 KB Output is correct