이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Memory2_lib.h"
#include <vector>
void Solve(int T, int N){
  std::vector<int> ans(2*N, -1);
  int x = 0, y = 1, z = -1;
  int lastComp = Flip(x, y);
  for(int i = 2; i < 2*N; i++) {
    int xComp = Flip(i, x);
    int yComp = Flip(i, y);
    if(z == -1) {
      if(xComp == lastComp && yComp != lastComp) {
        ans[x] = lastComp;
        lastComp = yComp;
        x = i;
      }
      else if(yComp == lastComp && xComp != lastComp) {
        ans[y] = lastComp;
        lastComp = xComp;
        y = i;
      }
      else if(xComp == lastComp && yComp == lastComp) {
        z = i;
      }
      else {
        ans[i] = xComp;
      }
    }
    else {
      if(xComp == lastComp && yComp == lastComp) {
        ans[x] = ans[y] = lastComp;
        x = z;
        y = i;
        z = -1;
        lastComp = Flip(x, y);
      }
      else if(xComp == lastComp && yComp != lastComp) {
        ans[x] = ans[z] = lastComp;
        x = i;
        z = -1;
        lastComp = yComp;
      }
      else if(xComp != lastComp && yComp == lastComp) {
        ans[y] = ans[z] = lastComp;
        y = i;
        z = -1;
        lastComp = xComp;
      }
      else {
        ans[i] = xComp;
      }
    }
  }
  ans[x] = ans[y] = lastComp;
  std::vector<std::vector<int> > output(N);
  for(int i = 0; i < 2*N; i++) {
    output[ans[i]].push_back(i);
  }
  for(int i = 0; i < N; i++)
    Answer(output[i][0], output[i][1], 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... |