Submission #280435

#TimeUsernameProblemLanguageResultExecution timeMemory
280435CaroLindaSplit the Attractions (IOI19_split)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "split.h" #define sz(x) (int)x.size() #define mkt make_tuple #define lp(i,a,b) for(int i = a ; i < b ; i++ ) #define ff first #define ss second #define eb emplace_back #define ll long long #define mk make_pair #define pii pair<int,int> #define debug printf #define all(x) x.begin(),x.end() const int MAXN = 1e5+10 ; using namespace std ; vector< vector<int> > adj ; vector<int> vec ; bool vis[MAXN] ; int sobra ; void dfs(int x ) { vis[x] = true ; vec.emplace_back(x) ; sobra-- ; for(auto e : adj[x]) if(!vis[e] && sobra > 0) dfs(e) ; } vector<int> find_split(int n , int a , int b , int c , vector<int> p ,vector<int> q ) { for(int i = 0 ; i <= n ; i++ ) adj.emplace_back( *(new vector<int>) ) ; for(int i = 0 ; i < sz(p) ; i++ ) adj[ p[i] ].emplace_back( q[i] ) ; int x = 1 ; lp(i,1,n+1) if( sz(adj[i]) < sz(adj[x]) ) x = i ; sobra = a ; dfs(x) ; sobra = b ; lp(i,1,n+1) if(!vis[i]) { dfs(i) ; break ; } lp(i,1,n+1) if(!vis[i]) vec.emplace_back(i) ; return vec ; } int N , M , A , B , C ; vector<int> p , q ; int main() { scanf("%d%d%d%d%d", &N , &M, &A, &B, &C ) ; for(int i = 0 , u, v ; i < M ; i++ ) { scanf("%d%d", &u, &v ) ; p.eb(u) ; q.eb(v) ; } vector<int> ans = find_split(N , A , B , C , p , q ) ; for(auto e : ans ) printf("%d " , e) ; printf("\n") ; }

Compilation message (stderr)

split.cpp: In function 'int main()':
split.cpp:70:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   70 |     scanf("%d%d%d%d%d", &N , &M, &A, &B, &C ) ;
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
split.cpp:73:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   73 |         scanf("%d%d", &u, &v ) ;
      |         ~~~~~^~~~~~~~~~~~~~~~~
/tmp/ccQKgjWD.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc4r64M9.o:split.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status