Submission #268157

#TimeUsernameProblemLanguageResultExecution timeMemory
268157wdjpngSplit the Attractions (IOI19_split)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define lint long long #define rep(i,n) for(int i = 0; i < n; i++) #define all(a) a.begin(), a.end() using namespace std; const int maxn=200000; int out[maxn]; bool vis[maxn]; int c=0; vector<int>val(3); vector<int>s; vector<vector<int>>E; void dfs(int i){ if(vis[i]){return;} vis[i]=true; c++; if(c<=s[0]){ out[i]=val[0]; } else if(c<=s[0]+s[1]){ out[i]=val[1]; } else{ out[i]=val[2]; } for(int w : E[i]){ dfs(w); } } vector<int> find_split(int n, int a, int b, int c, int p[], int q[]){ vector<int>s1={a,b,c}; s=s1; sort(all(s)); rep(i, p.size()){ E[p[i]].push_back(q[i]); E[q[i]].push_back(p[i]); } rep(i, 3){ rep(j, 3){ if(s1[i]==s[j]){ val[j]=i+1; } } } dfs(0); rep(i, n){ cout << out[i] <<" "; } }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, int*, int*)':
split.cpp:38:14: error: request for member 'size' in 'p', which is of non-class type 'int*'
   38 |     rep(i, p.size()){
      |              ^~~~
split.cpp:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int i = 0; i < n; i++)
      |                                     ^
split.cpp:55:1: warning: no return statement in function returning non-void [-Wreturn-type]
   55 | }
      | ^