# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
170346 | 2019-12-24T20:20:48 Z | ngmh | 도서관 (JOI18_library) | C++11 | 2000 ms | 532 KB |
#include <bits/stdc++.h> #include "library.h" using namespace std; void Solve(int N) { if(N == 1){ vector<int> edge; edge.push_back(1); Answer(edge); return; } vector<int> v(N); vector<int> adjlist[N+1]; long long A, S, T; for(int i = 1; i <= N; i++){ for(int j = 1; j <= N; j++){ if(i == j || adjlist[j].size() == 2) continue; if(find(adjlist[i].begin(), adjlist[i].end(), j) != adjlist[i].end()) continue; v[i-1] = v[j-1] = 1; A = Query(v); v[i-1] = v[j-1] = 0; if(A == 1){ adjlist[i].push_back(j); adjlist[j].push_back(i); if(adjlist[i].size() == 2) break; } } if(adjlist[i].size() == 1) S = i; } vector<int> res; res.push_back(S); T = adjlist[S][0]; while(true){ res.push_back(T); if(res.size() == N) break; for(int i = 0; i < adjlist[T].size(); i++){ if(adjlist[T][i] != S){ S = T; T = adjlist[T][i]; break; } } } Answer(res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 150 ms | 532 KB | # of queries: 10633 |
2 | Correct | 199 ms | 376 KB | # of queries: 10491 |
3 | Correct | 194 ms | 424 KB | # of queries: 11342 |
4 | Correct | 173 ms | 376 KB | # of queries: 11275 |
5 | Correct | 199 ms | 376 KB | # of queries: 11259 |
6 | Correct | 183 ms | 380 KB | # of queries: 11165 |
7 | Correct | 195 ms | 248 KB | # of queries: 11202 |
8 | Correct | 157 ms | 444 KB | # of queries: 10342 |
9 | Correct | 191 ms | 424 KB | # of queries: 11448 |
10 | Correct | 61 ms | 380 KB | # of queries: 4812 |
11 | Correct | 2 ms | 376 KB | # of queries: 0 |
12 | Correct | 2 ms | 248 KB | # of queries: 1 |
13 | Correct | 2 ms | 248 KB | # of queries: 4 |
14 | Correct | 2 ms | 376 KB | # of queries: 8 |
15 | Correct | 3 ms | 376 KB | # of queries: 90 |
16 | Correct | 6 ms | 248 KB | # of queries: 239 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 150 ms | 532 KB | # of queries: 10633 |
2 | Correct | 199 ms | 376 KB | # of queries: 10491 |
3 | Correct | 194 ms | 424 KB | # of queries: 11342 |
4 | Correct | 173 ms | 376 KB | # of queries: 11275 |
5 | Correct | 199 ms | 376 KB | # of queries: 11259 |
6 | Correct | 183 ms | 380 KB | # of queries: 11165 |
7 | Correct | 195 ms | 248 KB | # of queries: 11202 |
8 | Correct | 157 ms | 444 KB | # of queries: 10342 |
9 | Correct | 191 ms | 424 KB | # of queries: 11448 |
10 | Correct | 61 ms | 380 KB | # of queries: 4812 |
11 | Correct | 2 ms | 376 KB | # of queries: 0 |
12 | Correct | 2 ms | 248 KB | # of queries: 1 |
13 | Correct | 2 ms | 248 KB | # of queries: 4 |
14 | Correct | 2 ms | 376 KB | # of queries: 8 |
15 | Correct | 3 ms | 376 KB | # of queries: 90 |
16 | Correct | 6 ms | 248 KB | # of queries: 239 |
17 | Execution timed out | 3008 ms | 376 KB | Time limit exceeded |
18 | Execution timed out | 3038 ms | 336 KB | Time limit exceeded |
19 | Execution timed out | 3022 ms | 340 KB | Time limit exceeded |
20 | Execution timed out | 3071 ms | 424 KB | Time limit exceeded |
21 | Execution timed out | 3068 ms | 340 KB | Time limit exceeded |
22 | Execution timed out | 3075 ms | 340 KB | Time limit exceeded |
23 | Execution timed out | 3093 ms | 340 KB | Time limit exceeded |
24 | Incorrect | 1786 ms | 452 KB | Wrong Answer [3] |
25 | Execution timed out | 3041 ms | 424 KB | Time limit exceeded |
26 | Execution timed out | 3044 ms | 340 KB | Time limit exceeded |
27 | Incorrect | 1735 ms | 376 KB | Wrong Answer [3] |
28 | Correct | 90 ms | 376 KB | # of queries: 2995 |
29 | Correct | 88 ms | 376 KB | # of queries: 2992 |
30 | Correct | 89 ms | 336 KB | # of queries: 2995 |