Submission #399034

# Submission time Handle Problem Language Result Execution time Memory
399034 2021-05-05T05:51:45 Z galca The Collection Game (BOI21_swaps) C++14
0 / 100
1 ms 200 KB
#include "swaps.h"
//#include <vector>
using namespace std;

void solve(int N, int V) {
   vector<int> res(N);
   for (int i=0; i<N; i++) {
	  res[i] = i+1;
   }  

   for (int k = 2; k < (N + N - 1); k *= 2) {
      for (int j = k/2; j > 0; j /= 2) { 
         for (int i = 0; i < N; i++) {
             int ip = i ^ j; 
             if ((ip > i) && (ip < N)) {
				 if ((i ^ k) < i) schedule(res[ip], res[i]);
				 else schedule(res[i], res[ip]);
             }
         }

		 vector<int> v = visit();

		 int idx = 0;
  		for (int i = 0; i < N; i++) {
		   int ip = i ^ j; 
		   if ((ip > i) && (ip < N)) {
			  if (v[idx++] == 0) {
				  int tmp = res[i];
				  res[i] = res[ip];
				  res[ip] = tmp; 
			  }
           }
		}
      }
   }
   answer(res);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -