답안 #399020

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
399020 2021-05-05T04:36:17 Z galca The Collection Game (BOI21_swaps) C++17
컴파일 오류
0 ms 0 KB
#include "swaps.h"
#include <vector>
using namespace std;

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

   for (int k = 2; k <= N; 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) {
                if (i ^ k == 0) schedule(ip, i);
                else schedule(i, ip);
             }
         }

	     vector<int> v = visit();

  		for (int i = 0; i < N/2; i++) {
		   int ip = i ^ j; 
           if (ip > i) {
			  if (v[i]) {
				  int tmp = res[i];
				  res[i] = res[ip];
				  res[ip] = tmp; 
			  }
           }
		}
      }
   }
   answer(res);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:6:20: error: 'N' was not declared in this scope
    6 |    vector<int> res(N);
      |                    ^
swaps.cpp:16:27: warning: suggest parentheses around comparison in operand of '^' [-Wparentheses]
   16 |                 if (i ^ k == 0) schedule(ip, i);
      |                         ~~^~~~