이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Memory2_lib.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 128;
int a[N], b[N];
int query(int i, int j)
{
	if (a[i] != -1)
		return a[i];
	if (a[j] != -1)
		return a[j];
	return Flip(i, j);
}
void Do(int i, int n)
{
	int cnt[N] = {};
	int val = 0;
	memset(b, -1, sizeof(b));
	Loop (j,0,2*n) {
		if (i == j)
			continue;
		int x = query(i, j);
		b[j] = x;
		val ^= x;
		if (++cnt[x] > 2) {
			val = x;
			break;
		}
	}
	Loop (j,0,2*n) {
		if (b[j] != -1 && b[j] != val)
			a[j] = b[j];
	}
	a[i] = val;
}
void Solve(int, int n)
{
	memset(a, -1, sizeof(a));
	Loop (i,0,2*n) {
		if (a[i] == -1)
			Do(i, n);
	}
	Loop (i,0,2*n) Loop (j,i+1,2*n) {
		if (a[i] == a[j])
			Answer(i, j, a[i]);
	}
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |