Submission #26157

# Submission time Handle Problem Language Result Execution time Memory
26157 2017-06-28T07:05:00 Z 서규호(#1097) None (JOI16_memory2) C++14
100 / 100
0 ms 2024 KB
#include "Memory2_lib.h"
#include <bits/stdc++.h>

#define pb push_back

using namespace std;

int N;
int ans[102];
vector<pair<int,int>> tmp[52];

void Solve(int T, int n){
	N = n;
	for(int i=0; i<N*2; i+=2){
		tmp[Flip(i,i+1)].pb({i,i+1});
	}
	while(1){
		bool flag = false;
		for(int i=0; i<N; i++){
			if(tmp[i].size() < 2) continue;
			flag = true;
			int x1,y1,x2,y2;
			x1 = tmp[i][0].first; y1 = tmp[i][0].second;
			x2 = tmp[i][1].first; y2 = tmp[i][1].second;
			tmp[i].clear();
			int get;
			get = Flip(x1,x2);
			if(get != i){
				tmp[i].pb({y1,y2});
				tmp[get].pb({x1,x2});
				continue;
			}
			get = Flip(x1,y2);
			if(get != i){
				tmp[i].pb({y1,x2});
				tmp[get].pb({x1,y2});
				continue;
			}
			get = Flip(y1,x2);
			if(get != i){
				tmp[i].pb({x1,y2});
				tmp[get].pb({y1,x2});
				continue;
			}
			get = Flip(y1,y2);
			tmp[i].pb({x1,x2});
			tmp[get].pb({y1,y2});
		}
		if(!flag) break;
	}
	for(int i=0; i<N; i++) Answer(tmp[i][0].first,tmp[i][0].second,i);
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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