Submission #348025

#TimeUsernameProblemLanguageResultExecution timeMemory
348025beksultan04Split the Attractions (IOI19_split)C++14
Compilation error
0 ms0 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; #define lol long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scanl(a) scanf("%lld",&a); #define scanll(a,b) scanf("%lld %lld",&a, &b); #define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define scan1(a) scanf("%d",&a); #define scan2(a,b) scanf("%d %d",&a, &b); #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin()Ñ,s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); #define eps 1e-12 vector <int> v; bool vis[100001]; vector <int> g[100001]; void dfs(int x,int p){ vis[x]=1; for (int to : g[x]){ if (to != p && vis[to] == 0)dfs(to,x); } v.pb(x); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res; res.resize() int i,j,s=0; for (i=0;i<p.size();++i){ g[p[i]].pb(q[i]); g[q[i]].pb(p[i]); } for (i=0;i<n;++i){ if (g[i].size() == 1){ s = i; } } dfs(s,-1); for (i=0;i<v.size();++i){ if (i < a)index[i] = 1; else if (i < a+b)index[i] = 2; else index[i]=3; } for (i=0;i<n;++i){ res.pb(index[i]); } return res; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:36:16: error: no matching function for call to 'std::vector<int>::resize()'
   36 |     res.resize()
      |                ^
In file included from /usr/include/c++/9/vector:67,
                 from split.h:5,
                 from split.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:934:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
  934 |       resize(size_type __new_size)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:934:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/9/bits/stl_vector.h:954:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int]'
  954 |       resize(size_type __new_size, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:954:7: note:   candidate expects 2 arguments, 0 provided
split.cpp:38:7: error: 'i' was not declared in this scope
   38 |  for (i=0;i<p.size();++i){
      |       ^
split.cpp:42:7: error: 'i' was not declared in this scope
   42 |  for (i=0;i<n;++i){
      |       ^
split.cpp:44:13: error: 's' was not declared in this scope
   44 |             s = i;
      |             ^
split.cpp:47:6: error: 's' was not declared in this scope
   47 |  dfs(s,-1);
      |      ^
split.cpp:48:7: error: 'i' was not declared in this scope
   48 |  for (i=0;i<v.size();++i){
      |       ^
split.cpp:53:7: error: 'i' was not declared in this scope
   53 |  for (i=0;i<n;++i){
      |       ^