Submission #994926

# Submission time Handle Problem Language Result Execution time Memory
994926 2024-06-08T08:37:11 Z pera Library (JOI18_library) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "library.h"
using namespace std;
void solve(int N){
   vector<int> v , left(N);
   int L;
   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;
      }
   }
   left[L] = 1;
   v.push_back(L);
   for(int tt = 1;tt < N;tt ++){
      int x = v[tt - 1] , sz = 0;
      for(int bit = 10;bit >= 0;bit --){
         int t = sz + (1 << bit);
         if(t <= N - tt){
            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:19:10: warning: 'L' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |    left[L] = 1;
      |          ^
/usr/bin/ld: /tmp/cclAfI9y.o: in function `main':
grader.cpp:(.text.startup+0x25): undefined reference to `Solve(int)'
collect2: error: ld returned 1 exit status