답안 #994947

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994947 2024-06-08T08:47:17 Z pera 도서관 (JOI18_library) C++17
0 / 100
28 ms 600 KB
#include<bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N){
   vector<int> v , left(N + 1) , f(N);
   int L = -1;
   for(int i = 1;i <= N;i ++){
      f[i - 1] = 1;
   }
   for(int x = 1;x <= N;x ++){
      f[x - 1] = 0;
      if(Query(f) == 1){
         L = x;
         break;
      }
      f[x - 1] = 1;
   }
   assert(L != -1);
   left[L] = 1;
   v.push_back(L);
   for(int d = 1;d < N;d ++){
      int x = v[d - 1] , sz = 0;
      for(int bit = 11;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;
            }
         }
      }
      ++sz;
      for(int i = 1;i <= N;i ++){
         if(!left[i]){
            --sz;
         }
         if(sz == 0){
            sz = i;
            break;
         }
      }
      v.push_back(sz);
      left[sz] = 1;
   }
   Answer(v);
}

# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 344 KB # of queries: 2507
2 Correct 22 ms 344 KB # of queries: 2505
3 Correct 26 ms 432 KB # of queries: 2770
4 Correct 23 ms 600 KB # of queries: 2695
5 Correct 14 ms 344 KB # of queries: 2602
6 Correct 25 ms 344 KB # of queries: 2675
7 Correct 16 ms 340 KB # of queries: 2698
8 Correct 24 ms 344 KB # of queries: 2544
9 Correct 14 ms 344 KB # of queries: 2660
10 Correct 8 ms 344 KB # of queries: 1566
11 Runtime error 1 ms 344 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 344 KB # of queries: 2507
2 Correct 22 ms 344 KB # of queries: 2505
3 Correct 26 ms 432 KB # of queries: 2770
4 Correct 23 ms 600 KB # of queries: 2695
5 Correct 14 ms 344 KB # of queries: 2602
6 Correct 25 ms 344 KB # of queries: 2675
7 Correct 16 ms 340 KB # of queries: 2698
8 Correct 24 ms 344 KB # of queries: 2544
9 Correct 14 ms 344 KB # of queries: 2660
10 Correct 8 ms 344 KB # of queries: 1566
11 Runtime error 1 ms 344 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -