# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1093873 | 2024-09-27T21:29:43 Z | DobromirAngelov | 도서관 (JOI18_library) | C++14 | 388 ms | 708 KB |
#include "library.h" #include<bits/stdc++.h> using namespace std; const int MAXN=1005; int n; vector<int> m; bool used[MAXN]; int queryNot(int ind) { for(int i=0;i<n;i++) { m[i]=1; if(i==ind-1) m[i]=0; } return Query(m); } int query(vector<int> v) { for(int i=0;i<n;i++) m[i]=0; for(auto x: v) m[x-1]=1; return Query(m); } void Solve(int N) { n=N; m.resize(n); if(n==1) { vector<int> res; res.push_back(1); Answer(res); return; } int st=0; for(int i=1;i<=n;i++) { if(queryNot(i)==1) { st=i; break; } } vector<int> res; res.push_back(st); used[st]=1; vector<int> pot; pot.reserve(n); for(int i=2;i<=n;i++) { pot.clear(); for(int j=1;j<=n;j++) { if(!used[j]) pot.push_back(j); } int nxt=0; for(int j=0;(1<<j)<=(int)(pot.size()-1);j++) { vector<int> cur; for(int k=0;k<pot.size();k++) { if(k&(1<<j)) cur.push_back(pot[k]); } int cnt1=query(cur); cur.push_back(res.back()); int cnt2=query(cur); if(cnt1==cnt2) nxt|=(1<<j); } res.push_back(pot[nxt]); used[res.back()]=1; } Answer(res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 344 KB | # of queries: 2563 |
2 | Correct | 22 ms | 344 KB | # of queries: 2599 |
3 | Correct | 22 ms | 348 KB | # of queries: 2816 |
4 | Correct | 29 ms | 436 KB | # of queries: 2765 |
5 | Correct | 37 ms | 592 KB | # of queries: 2680 |
6 | Correct | 28 ms | 432 KB | # of queries: 2727 |
7 | Correct | 22 ms | 428 KB | # of queries: 2736 |
8 | Correct | 19 ms | 348 KB | # of queries: 2590 |
9 | Correct | 37 ms | 424 KB | # of queries: 2710 |
10 | Correct | 20 ms | 348 KB | # of queries: 1572 |
11 | Correct | 0 ms | 344 KB | # of queries: 0 |
12 | Correct | 0 ms | 348 KB | # of queries: 1 |
13 | Correct | 0 ms | 348 KB | # of queries: 4 |
14 | Correct | 0 ms | 348 KB | # of queries: 7 |
15 | Correct | 1 ms | 344 KB | # of queries: 83 |
16 | Correct | 2 ms | 344 KB | # of queries: 207 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 344 KB | # of queries: 2563 |
2 | Correct | 22 ms | 344 KB | # of queries: 2599 |
3 | Correct | 22 ms | 348 KB | # of queries: 2816 |
4 | Correct | 29 ms | 436 KB | # of queries: 2765 |
5 | Correct | 37 ms | 592 KB | # of queries: 2680 |
6 | Correct | 28 ms | 432 KB | # of queries: 2727 |
7 | Correct | 22 ms | 428 KB | # of queries: 2736 |
8 | Correct | 19 ms | 348 KB | # of queries: 2590 |
9 | Correct | 37 ms | 424 KB | # of queries: 2710 |
10 | Correct | 20 ms | 348 KB | # of queries: 1572 |
11 | Correct | 0 ms | 344 KB | # of queries: 0 |
12 | Correct | 0 ms | 348 KB | # of queries: 1 |
13 | Correct | 0 ms | 348 KB | # of queries: 4 |
14 | Correct | 0 ms | 348 KB | # of queries: 7 |
15 | Correct | 1 ms | 344 KB | # of queries: 83 |
16 | Correct | 2 ms | 344 KB | # of queries: 207 |
17 | Correct | 363 ms | 708 KB | # of queries: 18794 |
18 | Correct | 376 ms | 688 KB | # of queries: 18021 |
19 | Correct | 374 ms | 460 KB | # of queries: 18239 |
20 | Correct | 313 ms | 688 KB | # of queries: 17075 |
21 | Correct | 306 ms | 680 KB | # of queries: 16096 |
22 | Correct | 388 ms | 688 KB | # of queries: 18413 |
23 | Correct | 357 ms | 460 KB | # of queries: 17994 |
24 | Correct | 105 ms | 704 KB | # of queries: 8263 |
25 | Correct | 343 ms | 684 KB | # of queries: 17890 |
26 | Correct | 320 ms | 696 KB | # of queries: 16769 |
27 | Correct | 112 ms | 692 KB | # of queries: 8414 |
28 | Correct | 338 ms | 684 KB | # of queries: 17935 |
29 | Correct | 341 ms | 596 KB | # of queries: 17915 |
30 | Correct | 362 ms | 684 KB | # of queries: 17935 |