답안 #1114685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114685 2024-11-19T11:20:39 Z SalihSahin Povjerenstvo (COI22_povjerenstvo) C++14
100 / 100
228 ms 65216 KB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
 
const int N = 5e5 + 5;

vector<int> adj[N], adjrev[N];


int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);
   int n, m;
   cin>>n>>m;
   for(int i = 0; i < m; i++){
      int u, v;
      cin>>u>>v;
      adj[u].pb(v);
      adjrev[v].pb(u);
   }

   vector<int> ans;
   vector<int> nope(n+1);
   for(int i = 1; i <= n; i++){
      if(!nope[i]){
         ans.pb(i);
         for(auto itr: adjrev[i]) nope[itr] = 1;
         for(auto itr: adj[i]) nope[itr] = 1;
      }
   }

   cout<<ans.size()<<endl;
   for(auto itr: ans){
      cout<<itr<<" ";
   }
   cout<<endl;
   return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 118 ms 58308 KB Output is correct
2 Correct 118 ms 58112 KB Output is correct
3 Correct 5 ms 23888 KB Output is correct
4 Correct 38 ms 31024 KB Output is correct
5 Correct 80 ms 44228 KB Output is correct
6 Correct 79 ms 42168 KB Output is correct
7 Correct 74 ms 43192 KB Output is correct
8 Correct 81 ms 41520 KB Output is correct
9 Correct 177 ms 51900 KB Output is correct
10 Correct 163 ms 49604 KB Output is correct
11 Correct 193 ms 49088 KB Output is correct
12 Correct 189 ms 44988 KB Output is correct
13 Correct 154 ms 45500 KB Output is correct
14 Correct 152 ms 45500 KB Output is correct
15 Correct 142 ms 45780 KB Output is correct
16 Correct 117 ms 45756 KB Output is correct
17 Correct 31 ms 26704 KB Output is correct
18 Correct 50 ms 29256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 110 ms 58312 KB Output is correct
2 Correct 80 ms 42424 KB Output is correct
3 Correct 76 ms 42460 KB Output is correct
4 Correct 194 ms 48572 KB Output is correct
5 Correct 222 ms 49592 KB Output is correct
6 Correct 152 ms 54716 KB Output is correct
7 Correct 160 ms 54968 KB Output is correct
8 Correct 159 ms 54728 KB Output is correct
9 Correct 134 ms 54712 KB Output is correct
10 Correct 40 ms 28744 KB Output is correct
11 Correct 30 ms 29056 KB Output is correct
12 Correct 33 ms 29004 KB Output is correct
13 Correct 117 ms 62908 KB Output is correct
14 Correct 117 ms 65216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 24144 KB Output is correct
2 Correct 5 ms 24144 KB Output is correct
3 Correct 5 ms 24056 KB Output is correct
4 Correct 6 ms 23996 KB Output is correct
5 Correct 6 ms 24144 KB Output is correct
6 Correct 6 ms 24144 KB Output is correct
7 Correct 7 ms 24144 KB Output is correct
8 Correct 6 ms 24212 KB Output is correct
9 Correct 5 ms 23888 KB Output is correct
10 Correct 5 ms 23888 KB Output is correct
11 Correct 5 ms 23888 KB Output is correct
12 Correct 7 ms 24144 KB Output is correct
13 Correct 8 ms 24196 KB Output is correct
14 Correct 6 ms 23888 KB Output is correct
15 Correct 7 ms 24144 KB Output is correct
16 Correct 7 ms 24312 KB Output is correct
17 Correct 7 ms 24144 KB Output is correct
18 Correct 7 ms 23888 KB Output is correct
19 Correct 5 ms 24060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 118 ms 58308 KB Output is correct
2 Correct 118 ms 58112 KB Output is correct
3 Correct 5 ms 23888 KB Output is correct
4 Correct 38 ms 31024 KB Output is correct
5 Correct 80 ms 44228 KB Output is correct
6 Correct 79 ms 42168 KB Output is correct
7 Correct 74 ms 43192 KB Output is correct
8 Correct 81 ms 41520 KB Output is correct
9 Correct 177 ms 51900 KB Output is correct
10 Correct 163 ms 49604 KB Output is correct
11 Correct 193 ms 49088 KB Output is correct
12 Correct 189 ms 44988 KB Output is correct
13 Correct 154 ms 45500 KB Output is correct
14 Correct 152 ms 45500 KB Output is correct
15 Correct 142 ms 45780 KB Output is correct
16 Correct 117 ms 45756 KB Output is correct
17 Correct 31 ms 26704 KB Output is correct
18 Correct 50 ms 29256 KB Output is correct
19 Correct 110 ms 58312 KB Output is correct
20 Correct 80 ms 42424 KB Output is correct
21 Correct 76 ms 42460 KB Output is correct
22 Correct 194 ms 48572 KB Output is correct
23 Correct 222 ms 49592 KB Output is correct
24 Correct 152 ms 54716 KB Output is correct
25 Correct 160 ms 54968 KB Output is correct
26 Correct 159 ms 54728 KB Output is correct
27 Correct 134 ms 54712 KB Output is correct
28 Correct 40 ms 28744 KB Output is correct
29 Correct 30 ms 29056 KB Output is correct
30 Correct 33 ms 29004 KB Output is correct
31 Correct 117 ms 62908 KB Output is correct
32 Correct 117 ms 65216 KB Output is correct
33 Correct 6 ms 24144 KB Output is correct
34 Correct 5 ms 24144 KB Output is correct
35 Correct 5 ms 24056 KB Output is correct
36 Correct 6 ms 23996 KB Output is correct
37 Correct 6 ms 24144 KB Output is correct
38 Correct 6 ms 24144 KB Output is correct
39 Correct 7 ms 24144 KB Output is correct
40 Correct 6 ms 24212 KB Output is correct
41 Correct 5 ms 23888 KB Output is correct
42 Correct 5 ms 23888 KB Output is correct
43 Correct 5 ms 23888 KB Output is correct
44 Correct 7 ms 24144 KB Output is correct
45 Correct 8 ms 24196 KB Output is correct
46 Correct 6 ms 23888 KB Output is correct
47 Correct 7 ms 24144 KB Output is correct
48 Correct 7 ms 24312 KB Output is correct
49 Correct 7 ms 24144 KB Output is correct
50 Correct 7 ms 23888 KB Output is correct
51 Correct 5 ms 24060 KB Output is correct
52 Correct 126 ms 64712 KB Output is correct
53 Correct 71 ms 46520 KB Output is correct
54 Correct 69 ms 46520 KB Output is correct
55 Correct 173 ms 54460 KB Output is correct
56 Correct 228 ms 56248 KB Output is correct
57 Correct 172 ms 54840 KB Output is correct
58 Correct 155 ms 54968 KB Output is correct
59 Correct 159 ms 54972 KB Output is correct
60 Correct 35 ms 29256 KB Output is correct
61 Correct 27 ms 29008 KB Output is correct
62 Correct 34 ms 28996 KB Output is correct
63 Correct 122 ms 62908 KB Output is correct
64 Correct 126 ms 64036 KB Output is correct
65 Correct 36 ms 29512 KB Output is correct
66 Correct 210 ms 51904 KB Output is correct
67 Correct 166 ms 53176 KB Output is correct
68 Correct 168 ms 52008 KB Output is correct
69 Correct 37 ms 28856 KB Output is correct
70 Correct 85 ms 39580 KB Output is correct