Submission #294823

#TimeUsernameProblemLanguageResultExecution timeMemory
294823FashoSplit the Attractions (IOI19_split)C++14
7 / 100
110 ms22392 KiB
#include <algorithm> #include <iostream> #include <cassert> #include <climits> #include <cstdlib> #include <cstring> #include <iomanip> #include <numeric> #include <cstdio> #include <string> #include <vector> #include <cmath> #include <ctime> #include <queue> #include <stack> #include <map> #include <set> using namespace std; #define N 500005 #define ll long long int #define fo(i,x,y) for(int i=x;i<=y;i++) #define fs(ar,n) fo(i,1,n) cin>>ar[i] #define sp " " #define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false) #define pb push_back #define ppb pop_back #define fi first #define se second #define ii pair<int,int> #define lli pair<ll,ll> #define fast2 freopen ("in.txt","r",stdin);freopen ("out.txt","w",stdout); #define inf 1000000000 using namespace std; #include "split.h" using namespace std; ll nn,mm,x,y,z; vector<int> v[N],ans(nn); void f(int ind,int back) { // cerr<<ind<<endl; if(!x && !y && !z) return; if(x) ans[ind]=1,x--; else if(y) ans[ind]=2,y--; else ans[ind]=3,z--; for(int i=0;i<v[ind].size();i++) { int xx=v[ind][i]; if(xx!=back) f(xx,ind); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { mm=p.size(); nn=n; x=a; y=b; z=c; int rt=0; fo(i,0,mm-1) { int at=p[i]; int bt=q[i]; v[at].pb(bt); v[bt].pb(at); } // cerr<<ans.size()<<endl; ans.resize(nn); fo(i,0,nn-1) if(v[i].size()<2) rt=i; f(rt,rt); return ans; } // 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 'void f(int, int)':
split.cpp:52:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |  for(int i=0;i<v[ind].size();i++)
      |              ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...