#include "Memory2_lib.h"
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REPO(i,n) for(int (i)=1; (i)<=(int)(n); (i)++)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;
const int MAX_N = 55;
vector<pi> Val[MAX_N];
queue<int> Same;
void Solve(int T, int N){
for(int i=0; i<N; i++)
Val[Flip(i*2, i*2+1)].push_back(pi(i*2, i*2+1));
for(int i=0; i<N; i++)
if(SZ(Val[i]) == 2) Same.push(i);
while(!Same.empty()) {
int v = Same.front(); Same.pop();
pi a = Val[v][0], b = Val[v][1];
int aa[2] = {a.one, a.two}, bb[2] = {b.one, b.two};
for(int i=0; i<2; i++) for(int j=0; j<2; j++) {
int val = Flip(aa[i], bb[j]);
if(val != v) {
Val[val].push_back(pi(aa[i], bb[j]));
if(SZ(Val[val]) == 2) Same.push(val);
Answer(aa[1-i], bb[1-i], v);
}
}
}
for(int i=0; i<N; i++)
if(SZ(Val[i]) == 1)
Answer(Val[i][0].one, Val[i][0].two, i);
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2024 KB |
Wrong Answer[3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2024 KB |
Wrong Answer[3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2024 KB |
Wrong Answer[3] |
2 |
Halted |
0 ms |
0 KB |
- |