# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1059934 | 2024-08-15T09:25:26 Z | noyancanturk | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 427 ms | 600 KB |
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; #define pb push_back int n,d; vector<int> longest_trip(int N, int D) { n=N,d=D; if(2<=D){ deque<int>trip; trip.pb(0); for(int i=1;i<n;i++){ bool ok=are_connected({trip.back()},{i}); if(ok)trip.pb(i); else if(trip.size()==1){ trip.pb(i+1); trip.pb(i); i++; }else{ trip.push_front(i); } } return vector<int>(trip.begin(),trip.end()); } bool vis[n]{}; vis[0]=1; vector<int>trip; trip.pb(0); while(trip.size()<(N+1)/2){ //cerr<<trip.size()<<"\n"; vector<int>myguys; for(int j=0;j<n;j++){ if(j==trip.back())continue; bool ok=are_connected({trip.back()},{j}); //cerr<<"trying "<<trip.back()<<" "<<j<<"\n"; if(!ok)myguys.pb(j); if(myguys.size()==(N+1)/2){ return myguys; } if(ok&&!vis[j]){ trip.push_back(j); vis[j]=1; break; } } cerr<<myguys.size()<<" my guys\n"; } return trip; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 344 KB | Output is correct |
2 | Correct | 5 ms | 344 KB | Output is correct |
3 | Correct | 4 ms | 344 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
5 | Correct | 4 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 344 KB | Output is correct |
2 | Correct | 5 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
5 | Correct | 5 ms | 344 KB | Output is correct |
6 | Correct | 5 ms | 344 KB | Output is correct |
7 | Correct | 5 ms | 344 KB | Output is correct |
8 | Correct | 6 ms | 344 KB | Output is correct |
9 | Correct | 5 ms | 344 KB | Output is correct |
10 | Correct | 5 ms | 344 KB | Output is correct |
11 | Correct | 5 ms | 344 KB | Output is correct |
12 | Correct | 6 ms | 340 KB | Output is correct |
13 | Correct | 4 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 344 KB | Output is correct |
2 | Correct | 7 ms | 344 KB | Output is correct |
3 | Correct | 29 ms | 344 KB | Output is correct |
4 | Correct | 91 ms | 412 KB | Output is correct |
5 | Correct | 207 ms | 428 KB | Output is correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Correct | 9 ms | 344 KB | Output is correct |
8 | Correct | 34 ms | 344 KB | Output is correct |
9 | Correct | 75 ms | 592 KB | Output is correct |
10 | Correct | 207 ms | 420 KB | Output is correct |
11 | Correct | 188 ms | 420 KB | Output is correct |
12 | Correct | 182 ms | 344 KB | Output is correct |
13 | Correct | 188 ms | 416 KB | Output is correct |
14 | Correct | 5 ms | 340 KB | Output is correct |
15 | Correct | 8 ms | 344 KB | Output is correct |
16 | Correct | 11 ms | 344 KB | Output is correct |
17 | Correct | 20 ms | 416 KB | Output is correct |
18 | Correct | 36 ms | 416 KB | Output is correct |
19 | Correct | 73 ms | 416 KB | Output is correct |
20 | Correct | 70 ms | 344 KB | Output is correct |
21 | Correct | 213 ms | 416 KB | Output is correct |
22 | Correct | 204 ms | 344 KB | Output is correct |
23 | Correct | 197 ms | 420 KB | Output is correct |
24 | Correct | 197 ms | 420 KB | Output is correct |
25 | Correct | 3 ms | 344 KB | Output is correct |
26 | Correct | 4 ms | 344 KB | Output is correct |
27 | Correct | 7 ms | 344 KB | Output is correct |
28 | Correct | 6 ms | 344 KB | Output is correct |
29 | Correct | 6 ms | 344 KB | Output is correct |
30 | Correct | 40 ms | 344 KB | Output is correct |
31 | Correct | 40 ms | 436 KB | Output is correct |
32 | Correct | 89 ms | 344 KB | Output is correct |
33 | Correct | 72 ms | 416 KB | Output is correct |
34 | Correct | 66 ms | 412 KB | Output is correct |
35 | Correct | 80 ms | 428 KB | Output is correct |
36 | Correct | 182 ms | 416 KB | Output is correct |
37 | Correct | 226 ms | 420 KB | Output is correct |
38 | Correct | 256 ms | 592 KB | Output is correct |
39 | Correct | 296 ms | 416 KB | Output is correct |
40 | Correct | 281 ms | 424 KB | Output is correct |
41 | Correct | 414 ms | 440 KB | Output is correct |
42 | Correct | 342 ms | 592 KB | Output is correct |
43 | Correct | 427 ms | 436 KB | Output is correct |
44 | Correct | 386 ms | 420 KB | Output is correct |
45 | Correct | 4 ms | 344 KB | Output is correct |
46 | Correct | 4 ms | 344 KB | Output is correct |
47 | Correct | 7 ms | 344 KB | Output is correct |
48 | Correct | 7 ms | 344 KB | Output is correct |
49 | Correct | 7 ms | 344 KB | Output is correct |
50 | Correct | 49 ms | 420 KB | Output is correct |
51 | Correct | 34 ms | 344 KB | Output is correct |
52 | Correct | 88 ms | 416 KB | Output is correct |
53 | Correct | 63 ms | 412 KB | Output is correct |
54 | Correct | 63 ms | 412 KB | Output is correct |
55 | Correct | 71 ms | 344 KB | Output is correct |
56 | Correct | 203 ms | 412 KB | Output is correct |
57 | Correct | 159 ms | 344 KB | Output is correct |
58 | Correct | 138 ms | 344 KB | Output is correct |
59 | Correct | 244 ms | 416 KB | Output is correct |
60 | Correct | 268 ms | 592 KB | Output is correct |
61 | Correct | 341 ms | 420 KB | Output is correct |
62 | Correct | 316 ms | 600 KB | Output is correct |
63 | Correct | 381 ms | 420 KB | Output is correct |
64 | Correct | 375 ms | 420 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |