This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |