# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
649603 | 2022-10-11T03:30:49 Z | PoonYaPat | 도서관 (JOI18_library) | C++14 | 259 ms | 262144 KB |
#include <bits/stdc++.h> #include "library.h" using namespace std; int query(vector<int> x) { bool check=false; for (int i=0; i<x.size(); ++i) if (x[i]) check=true; if (check) return Query(x); else return -1; } void Solve(int n) { int now=-1,pre=-1,ed; vector<int> test,ans; for (int i=0; i<n; ++i) test.push_back(1); for (int i=0; i<n; ++i) { test[i]=0; if (Query(test)==1) { if (now==-1) now=i; else ed=i; } test[i]=1; } ans.push_back(now+1); while (now!=ed) { int l=0, r=n-1; while (l<r) { int mid=(l+r)/2; for (int i=0; i<n; ++i) { if (i==pre) test[i]=0; else if (i>=mid+1 && i<=r) test[i]=1; else test[i]=0; } int k1=query(test); test[now]=1-test[now]; int k2=query(test); if (k1==k2) l=mid+1; else r=mid; } ans.push_back(r+1); pre=now; now=r; } Answer(ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 208 KB | # of queries: 3119 |
2 | Correct | 40 ms | 208 KB | # of queries: 3102 |
3 | Correct | 38 ms | 208 KB | # of queries: 3271 |
4 | Correct | 53 ms | 208 KB | # of queries: 3271 |
5 | Correct | 33 ms | 208 KB | # of queries: 3271 |
6 | Correct | 44 ms | 208 KB | # of queries: 3268 |
7 | Correct | 49 ms | 208 KB | # of queries: 3272 |
8 | Correct | 48 ms | 208 KB | # of queries: 3140 |
9 | Correct | 50 ms | 208 KB | # of queries: 3252 |
10 | Correct | 19 ms | 208 KB | # of queries: 1923 |
11 | Runtime error | 259 ms | 262144 KB | Execution killed with signal 9 |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 208 KB | # of queries: 3119 |
2 | Correct | 40 ms | 208 KB | # of queries: 3102 |
3 | Correct | 38 ms | 208 KB | # of queries: 3271 |
4 | Correct | 53 ms | 208 KB | # of queries: 3271 |
5 | Correct | 33 ms | 208 KB | # of queries: 3271 |
6 | Correct | 44 ms | 208 KB | # of queries: 3268 |
7 | Correct | 49 ms | 208 KB | # of queries: 3272 |
8 | Correct | 48 ms | 208 KB | # of queries: 3140 |
9 | Correct | 50 ms | 208 KB | # of queries: 3252 |
10 | Correct | 19 ms | 208 KB | # of queries: 1923 |
11 | Runtime error | 259 ms | 262144 KB | Execution killed with signal 9 |
12 | Halted | 0 ms | 0 KB | - |