Submission #959997

# Submission time Handle Problem Language Result Execution time Memory
959997 2024-04-09T12:03:56 Z pcc Povjerenstvo (COI22_povjerenstvo) C++17
0 / 100
114 ms 34256 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")

#define pii pair<int,int>
#define fs first
#define sc second
#define ll long long

const int mxn = 5e5+10;

int N,M;
vector<int> paths[mxn];
int deg[mxn];
bitset<mxn> done;
vector<int> v;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>M;
	for(int i = 1;i<=M;i++){
		int a,b;
		cin>>a>>b;
		paths[b].push_back(a);
	}
	for(int i = 1;i<=N;i++){
		if(!done[i]&&!paths[i].empty()){
			assert(paths[i].size() == 1);
			done[paths[i][0]] = done[i] = true;
			v.push_back(i);
		}
	}
	for(int i = 1;i<=N;i++)if(!done[i])v.push_back(i);
	cout<<v.size()<<'\n';
	for(auto &i:v)cout<<i<<' ';cout<<'\n';
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:37:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   37 |  for(auto &i:v)cout<<i<<' ';cout<<'\n';
      |  ^~~
Main.cpp:37:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   37 |  for(auto &i:v)cout<<i<<' ';cout<<'\n';
      |                             ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 34256 KB There must not be two people within the committee such that one person dislikes the other.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 34244 KB There must not be two people within the committee such that one person dislikes the other.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 14168 KB There must not be two people within the committee such that one person dislikes the other.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 34256 KB There must not be two people within the committee such that one person dislikes the other.
2 Halted 0 ms 0 KB -