답안 #994935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994935 2024-06-08T08:40:17 Z pera 도서관 (JOI18_library) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N){
   vector<int> v , left(N + 1);
   int L = -1;
   for(int i = 1;i <= N;i ++){
      vector<int> u(N);
      for(int x = 1;x <= N;x ++){
         if(x != i){
            u[x - 1] = 1;
         }
      }
      if(Query(u) == 1){
         L = i;
         break;
      }
   }
   assert(L != -1);
   left[L] = 1;
   v.push_back(L);
   for(int d = 1;d < N;d ++){
      int x = v[tt - 1] , sz = 0;
      for(int bit = 10;bit >= 0;bit --){
         int t = sz + (1 << bit);
         if(t <= N - d){
            int cnt = t;
            vector<int> u(N);
            for(int i = 1;i <= N;i ++){
               if(!left[i] && cnt > 0){
                  --cnt;
                  u[i - 1] = 1;
               }
            }
            int bef = Query(u);
            u[x - 1] = 1;
            int now = Query(u);
            if(now != bef){
               sz = t;
            }
         }
      }
      int cnt = sz + 1;
      for(int i = 1;i <= N;i ++){
         if(!left[i]){
            --cnt;
         }
         if(cnt == 0){
            cnt = i;
            break;
         }
      }
      v.push_back(cnt);
      left[cnt] = 1;
   }
   Answer(v);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:23:17: error: 'tt' was not declared in this scope; did you mean 'tm'?
   23 |       int x = v[tt - 1] , sz = 0;
      |                 ^~
      |                 tm
library.cpp:25:18: error: 'sz' was not declared in this scope
   25 |          int t = sz + (1 << bit);
      |                  ^~
library.cpp:43:17: error: 'sz' was not declared in this scope
   43 |       int cnt = sz + 1;
      |                 ^~