# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
849903 | 2023-09-15T14:25:22 Z | 1075508020060209tc | Povjerenstvo (COI22_povjerenstvo) | C++14 | 412 ms | 43540 KB |
#include<bits/stdc++.h> using namespace std; //#define int long long int n;int m; vector<int>er[500005]; int dgr[500005]; int isin[500005]; int has[500005]; signed main(){ cin>>n>>m; for(int i=1;i<=m;i++){ int a;int b; cin>>a>>b; er[b].push_back(a); dgr[a]++; } queue<int>q; for(int i=1;i<=n;i++){ if(dgr[i]==0){ q.push(i); isin[i]=1; } } while(q.size()){ int nw=q.front(); q.pop(); for(int i=0;i<er[nw].size();i++){ int v=er[nw][i]; dgr[v]--; if( isin[nw] ){ has[v]=1; } if(dgr[v]==0){ if(has[v]==0){ isin[v]=1; } q.push(v); } } } vector<int>ans; for(int i=1;i<=n;i++){ if(isin[i]){ans.push_back(i);} } cout<<ans.size()<<endl; for(int i=0;i<ans.size();i++){ cout<<ans[i]<<" "; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 294 ms | 41924 KB | Output is correct |
2 | Correct | 297 ms | 42072 KB | Output is correct |
3 | Correct | 3 ms | 15708 KB | Output is correct |
4 | Correct | 43 ms | 24284 KB | Output is correct |
5 | Correct | 159 ms | 32640 KB | Output is correct |
6 | Correct | 235 ms | 43088 KB | Output is correct |
7 | Correct | 204 ms | 26212 KB | Output is correct |
8 | Correct | 218 ms | 36048 KB | Output is correct |
9 | Correct | 390 ms | 35052 KB | Output is correct |
10 | Correct | 288 ms | 41680 KB | Output is correct |
11 | Correct | 348 ms | 38144 KB | Output is correct |
12 | Correct | 379 ms | 35888 KB | Output is correct |
13 | Correct | 331 ms | 36176 KB | Output is correct |
14 | Correct | 323 ms | 36428 KB | Output is correct |
15 | Correct | 314 ms | 36544 KB | Output is correct |
16 | Correct | 321 ms | 36456 KB | Output is correct |
17 | Correct | 99 ms | 21456 KB | Output is correct |
18 | Correct | 165 ms | 24288 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 301 ms | 41912 KB | Output is correct |
2 | Correct | 240 ms | 43540 KB | Output is correct |
3 | Correct | 184 ms | 25788 KB | Output is correct |
4 | Correct | 356 ms | 37556 KB | Output is correct |
5 | Incorrect | 412 ms | 38168 KB | For each person outside the committee there should be someone in the committee who they dislike. |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 18012 KB | Output is correct |
2 | Correct | 6 ms | 18264 KB | Output is correct |
3 | Correct | 5 ms | 17756 KB | Output is correct |
4 | Correct | 6 ms | 18012 KB | Output is correct |
5 | Incorrect | 6 ms | 18012 KB | For each person outside the committee there should be someone in the committee who they dislike. |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 294 ms | 41924 KB | Output is correct |
2 | Correct | 297 ms | 42072 KB | Output is correct |
3 | Correct | 3 ms | 15708 KB | Output is correct |
4 | Correct | 43 ms | 24284 KB | Output is correct |
5 | Correct | 159 ms | 32640 KB | Output is correct |
6 | Correct | 235 ms | 43088 KB | Output is correct |
7 | Correct | 204 ms | 26212 KB | Output is correct |
8 | Correct | 218 ms | 36048 KB | Output is correct |
9 | Correct | 390 ms | 35052 KB | Output is correct |
10 | Correct | 288 ms | 41680 KB | Output is correct |
11 | Correct | 348 ms | 38144 KB | Output is correct |
12 | Correct | 379 ms | 35888 KB | Output is correct |
13 | Correct | 331 ms | 36176 KB | Output is correct |
14 | Correct | 323 ms | 36428 KB | Output is correct |
15 | Correct | 314 ms | 36544 KB | Output is correct |
16 | Correct | 321 ms | 36456 KB | Output is correct |
17 | Correct | 99 ms | 21456 KB | Output is correct |
18 | Correct | 165 ms | 24288 KB | Output is correct |
19 | Correct | 301 ms | 41912 KB | Output is correct |
20 | Correct | 240 ms | 43540 KB | Output is correct |
21 | Correct | 184 ms | 25788 KB | Output is correct |
22 | Correct | 356 ms | 37556 KB | Output is correct |
23 | Incorrect | 412 ms | 38168 KB | For each person outside the committee there should be someone in the committee who they dislike. |
24 | Halted | 0 ms | 0 KB | - |