# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
744280 | 2023-05-18T10:20:54 Z | MON | 도서관 (JOI18_library) | C++14 | 564 ms | 308 KB |
#include <cstdio> #include <vector> #include "library.h" using namespace std; void Solve(int N) { vector<int> m(N,0); if(N <= 2) { vector<int> ans; if(N == 1) ans = {1}; else ans = {1,2}; Answer(ans);return; } vector<int> vecini[N]; int luat[N] = {0}; for(int i = 0 ; i < N - 1 ; i++) { for(int j = i + 1 ; j < N ; j++) { fill(m.begin(),m.end(),0); m[i] = m[j] = 1; int sunt = Query(m); if(sunt != 1) sunt = 0; if(sunt) { vecini[i].emplace_back(j); vecini[j].emplace_back(i); } } } vector<int> ans; for(int i = 0; i < N ; i++) { if(vecini[i].size() == 1) { ans.emplace_back(i); luat[i] = 1; break; } } while(ans.size() < N) { for(auto &it : vecini[ans.back()]) { if(!luat[it]) { luat[it] = 1; ans.emplace_back(it); break; } } } for(auto &it : ans) it++; Answer(ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 291 ms | 284 KB | # of queries: 18336 |
2 | Correct | 305 ms | 280 KB | # of queries: 18145 |
3 | Correct | 299 ms | 284 KB | # of queries: 19900 |
4 | Correct | 282 ms | 284 KB | # of queries: 19900 |
5 | Correct | 296 ms | 288 KB | # of queries: 19900 |
6 | Correct | 352 ms | 284 KB | # of queries: 19900 |
7 | Correct | 300 ms | 288 KB | # of queries: 19900 |
8 | Correct | 267 ms | 284 KB | # of queries: 18528 |
9 | Correct | 187 ms | 284 KB | # of queries: 19701 |
10 | Correct | 104 ms | 280 KB | # of queries: 8256 |
11 | Correct | 0 ms | 208 KB | # of queries: 0 |
12 | Correct | 0 ms | 208 KB | # of queries: 0 |
13 | Correct | 1 ms | 208 KB | # of queries: 3 |
14 | Correct | 2 ms | 208 KB | # of queries: 6 |
15 | Correct | 2 ms | 208 KB | # of queries: 105 |
16 | Correct | 6 ms | 208 KB | # of queries: 351 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 291 ms | 284 KB | # of queries: 18336 |
2 | Correct | 305 ms | 280 KB | # of queries: 18145 |
3 | Correct | 299 ms | 284 KB | # of queries: 19900 |
4 | Correct | 282 ms | 284 KB | # of queries: 19900 |
5 | Correct | 296 ms | 288 KB | # of queries: 19900 |
6 | Correct | 352 ms | 284 KB | # of queries: 19900 |
7 | Correct | 300 ms | 288 KB | # of queries: 19900 |
8 | Correct | 267 ms | 284 KB | # of queries: 18528 |
9 | Correct | 187 ms | 284 KB | # of queries: 19701 |
10 | Correct | 104 ms | 280 KB | # of queries: 8256 |
11 | Correct | 0 ms | 208 KB | # of queries: 0 |
12 | Correct | 0 ms | 208 KB | # of queries: 0 |
13 | Correct | 1 ms | 208 KB | # of queries: 3 |
14 | Correct | 2 ms | 208 KB | # of queries: 6 |
15 | Correct | 2 ms | 208 KB | # of queries: 105 |
16 | Correct | 6 ms | 208 KB | # of queries: 351 |
17 | Runtime error | 564 ms | 308 KB | Execution killed with signal 13 |
18 | Halted | 0 ms | 0 KB | - |