Submission #169817

#TimeUsernameProblemLanguageResultExecution timeMemory
169817arthur_nascimentoSplit the Attractions (IOI19_split)C++14
0 / 100
46 ms7032 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define debug #define ll long long #define maxn 2525 #define pii pair<int,int> using namespace std; int sz[3]; int id0,id1,id2; int ans[maxn]; vector<int> L[maxn]; int vis[maxn]; int color(int vx,int qtd,int to){ //qtd--; //ans[vx] = to; debug("+%d\n",vx); queue<int> Q; Q.push(vx); vis[vx] = 1; while(qtd){ int nov = Q.front(); Q.pop(); ans[nov] = to;debug("+%d\n",nov); qtd--; for(int i=0;i<L[nov].size();i++){ int yy = L[nov][i]; if(!vis[yy]){ vis[yy] = 1; debug("push %d\n",yy); Q.push(yy); } } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { sz[0] = a; sz[1] = b; sz[2] = c; for(int i=0;i<p.size();i++) L[p[i]].pb(q[i]), L[q[i]].pb(p[i]); vector<pii> vv; for(int i=0;i<3;i++){ vv.pb(pii(sz[i],i)); } sort(vv.begin(),vv.end()); id0 = vv[0].second; id1 = vv[1].second; id2 = vv[2].second; for(int i=0;i<n;i++) ans[i] = id2+1; if(sz[id0] == 1){ color(0,sz[id1],id1+1); for(int i=0;i<n;i++) if(ans[i] == id2+1){ ans[i] = id0+1; break; } } vector<int> res; for(int i=0;i<n;i++) res.pb(ans[i]); return res; }

Compilation message (stderr)

split.cpp: In function 'int color(int, int, int)':
split.cpp:28:31: warning: left operand of comma operator has no effect [-Wunused-value]
   ans[nov] = to;debug("+%d\n",nov);
                               ^~~
split.cpp:30:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<L[nov].size();i++){
               ~^~~~~~~~~~~~~~
split.cpp:33:36: warning: left operand of comma operator has no effect [-Wunused-value]
     vis[yy] = 1; debug("push %d\n",yy);
                                    ^~
split.cpp:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:47:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<p.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...