# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
654626 | 2022-11-01T02:53:39 Z | uylulu | 도서관 (JOI18_library) | C++17 | 37 ms | 308 KB |
#include<bits/stdc++.h> #include <cstdio> #include <vector> #include "library.h" using namespace std; int n; int ask(vector<int> st) { vector<int> num(n,0); for(auto u : st) { num[u - 1] = 1; } return Query(num); } const int N = 1e3; int res[N + 1]; vector<int> crr; bool check[N + 1]; void dnc(int lst) { // for(auto u : crr) { // cout<<u<<" "; // } // cout<<endl; if(crr.size() == 1) { res[lst + 1] = crr[0]; check[res[lst + 1]] = true; crr.clear(); return; } vector<int> fi,se; for(int i = 0;i < crr.size()/2;i++) { fi.push_back(crr[i]); } for(int i = crr.size()/2;i < crr.size();i++) { se.push_back(crr[i]); } int dad = ask(fi); fi.push_back(res[lst]); int mom = ask(fi); if(dad == mom) { fi.pop_back(); crr = fi; } else { crr = se; } dnc(lst); } void Solve(int len) { n = len; for(int i = 1;i <= n;i++) { vector<int> asd; for(int j = 1;j <= n;j++) { if(i == j) continue; asd.push_back(j); } if(ask(asd) == 1) { res[1] = i; break; } } check[res[1]] = true; for(int i = 2;i <= n;i++) { crr.clear(); for(int j = 1;j <= n;j++) { if(!check[j]) { crr.push_back(j); } } dnc(i - 1); // cout<<"DONE"<<" "<<i<<" "<<res[i]<<endl; } vector<int> kq(n,0); for(int i = 0;i < n;i++) { kq[i] = res[i + 1]; } Answer(kq); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 308 KB | # of queries: 2375 |
2 | Correct | 36 ms | 308 KB | # of queries: 2409 |
3 | Correct | 36 ms | 208 KB | # of queries: 2648 |
4 | Correct | 37 ms | 208 KB | # of queries: 2595 |
5 | Correct | 28 ms | 208 KB | # of queries: 2508 |
6 | Correct | 32 ms | 208 KB | # of queries: 2551 |
7 | Correct | 35 ms | 208 KB | # of queries: 2544 |
8 | Correct | 34 ms | 208 KB | # of queries: 2420 |
9 | Correct | 35 ms | 208 KB | # of queries: 2546 |
10 | Correct | 17 ms | 208 KB | # of queries: 1474 |
11 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 308 KB | # of queries: 2375 |
2 | Correct | 36 ms | 308 KB | # of queries: 2409 |
3 | Correct | 36 ms | 208 KB | # of queries: 2648 |
4 | Correct | 37 ms | 208 KB | # of queries: 2595 |
5 | Correct | 28 ms | 208 KB | # of queries: 2508 |
6 | Correct | 32 ms | 208 KB | # of queries: 2551 |
7 | Correct | 35 ms | 208 KB | # of queries: 2544 |
8 | Correct | 34 ms | 208 KB | # of queries: 2420 |
9 | Correct | 35 ms | 208 KB | # of queries: 2546 |
10 | Correct | 17 ms | 208 KB | # of queries: 1474 |
11 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
12 | Halted | 0 ms | 0 KB | - |