Submission #832925

#TimeUsernameProblemLanguageResultExecution timeMemory
832925Marco_EscandonSplit the Attractions (IOI19_split)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> cad[200001]; vector<ll> asd={0,1,2}; vector<ll> d; vector<int> sol; ll po; ll dfs(ll node,ll p) { for(auto i:cad[node]) { if(i!=p) { if(dfs(i,node)== false) return false; //cout<<node<<" "<<sol[node]<<" "<<asd[po]+1<<" "<<d[asd[po]]<<po<<"\n\n"; if(sol[node]!=asd[po]+1 && sol[node]!=0 && d[asd[po]]!=0) { //cout<<"asd"; return false; } if(sol[node]==0) { if(d[asd[po]]==0) { po++; } sol[node]=asd[po]+1; d[asd[po]]--; } } } if(sol[node]==0) { if(d[asd[po]]==0) { po++; } sol[node]=asd[po]+1; d[asd[po]]--; } return true; } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { for(int i=0; i<p.size(); i++) { cad[p[i]].push_back(q[i]); cad[q[i]].push_back(p[i]); } do { //cout<<asd[0]<<asd[1]<<asd[2]<<"\n"; sol.assign(n,0); d.clear(); d.push_back(a); d.push_back(b); d.push_back(c); po=0; if(dfs(0,-1)==true) { return sol; } } while(next_permutation(asd.begin(),asd.end())); vector<int> no(n,0); return no; } int main() { int n, m, a, b, c; assert(5 == scanf("%d%d%d%d%d", &n, &m, &a, &b, &c)); vector<int> p(m), q(m); for (int i=0; i<m; i++) assert(2 == scanf("%d%d", &p[i], &q[i])); fclose(stdin); vector<int> result = find_split(n, a, b, c, p, q); for (int i=0; i<(int)result.size(); i++) printf("%s%d", ((i>0)?" ":""), result[i]); printf("\n"); fclose(stdout); return 0; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:48:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for(int i=0; i<p.size(); i++)
      |                  ~^~~~~~~~~
/usr/bin/ld: /tmp/cc0RVpoH.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccDZ8lMI.o:split.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status