Submission #42571

#TimeUsernameProblemLanguageResultExecution timeMemory
42571nonocutAdriatic (CEOI13_adriatic)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define X first #define Y second const int maxv = 2500; const int maxn = 250000 + 5; struct node { int x,y,id; }; int n; node p[maxn]; int pos[maxv+5]; vector<int> way[maxn]; bool cmp(node a, node b) { if(a.x!=b.x) return a.x<b.x; return a.y>b.y; } int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d%d",&p[i].x,&p[i].y), p[i].id = i; sort(&p[1],&p[n+1],cmp); for(int i=1;i<=n;i++) { int cur = 0; for(int y=p[i].y-1;y>=1;y--) { if(pos[y]>cur) { cur = pos[y]; way[p[i].id].push_back(p[pos[y]].id,1); } } pos[p[i].y] = i; } }

Compilation message (stderr)

adriatic.cpp: In function 'int main()':
adriatic.cpp:28:54: error: no matching function for call to 'std::vector<int>::push_back(int&, int)'
                 way[p[i].id].push_back(p[pos[y]].id,1);
                                                      ^
In file included from /usr/include/c++/5/vector:64:0,
                 from /usr/include/c++/5/bits/random.h:34,
                 from /usr/include/c++/5/random:49,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from adriatic.cpp:1:
/usr/include/c++/5/bits/stl_vector.h:913:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]
       push_back(const value_type& __x)
       ^
/usr/include/c++/5/bits/stl_vector.h:913:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/5/bits/stl_vector.h:931:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]
       push_back(value_type&& __x)
       ^
/usr/include/c++/5/bits/stl_vector.h:931:7: note:   candidate expects 1 argument, 2 provided
adriatic.cpp:20:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
adriatic.cpp:21:66: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d%d",&p[i].x,&p[i].y), p[i].id = i;
                                                                  ^