Submission #1073470

#TimeUsernameProblemLanguageResultExecution timeMemory
1073470blushingecchigirlComparing Plants (IOI20_plants)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back vector<pair<pair<int>, int>> p; void init(int k, std::vector<int> r) { int n = r.size(), x; p.resize(n); for(int i = 0; i<n; i++) { if(r[i]!=r[(i+1)%n]) { x = i; break; } } int cur = 0, g = 0; for(int i = x; i<n+x; i++) { p[i%n].second = cur; if(r[i%n]) cur--; else cur++; p[i%n].first.first = p[(i+1)%n].first.second = g; if(r[i%n] != r[(i+1)%n]) g++; } return; } int compare_plants(int x, int y) { auto a = p[x].first, b = p[y].first; if(a.first == b.first || a.first == b.second || a.second == b.first || a.second == b.second) { if(p[x].second>p[y].second) return 1; return -1; } return 0; }

Compilation message (stderr)

plants.cpp:6:21: error: wrong number of template arguments (1, should be 2)
    6 | vector<pair<pair<int>, int>> p;
      |                     ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from plants.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
  211 |     struct pair
      |            ^~~~
plants.cpp:6:24: error: template argument 1 is invalid
    6 | vector<pair<pair<int>, int>> p;
      |                        ^~~
plants.cpp:6:27: error: template argument 1 is invalid
    6 | vector<pair<pair<int>, int>> p;
      |                           ^~
plants.cpp:6:27: error: template argument 2 is invalid
plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:10:7: error: request for member 'resize' in 'p', which is of non-class type 'int'
   10 |     p.resize(n);
      |       ^~~~~~
plants.cpp:20:10: error: invalid types 'int[int]' for array subscript
   20 |         p[i%n].second = cur;
      |          ^
plants.cpp:23:10: error: invalid types 'int[int]' for array subscript
   23 |         p[i%n].first.first = p[(i+1)%n].first.second = g;
      |          ^
plants.cpp:23:31: error: invalid types 'int[int]' for array subscript
   23 |         p[i%n].first.first = p[(i+1)%n].first.second = g;
      |                               ^
plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:29:15: error: invalid types 'int[int]' for array subscript
   29 |     auto a = p[x].first, b = p[y].first;
      |               ^
plants.cpp:30:19: error: 'b' was not declared in this scope
   30 |     if(a.first == b.first || a.first == b.second || a.second == b.first || a.second == b.second) {
      |                   ^
plants.cpp:31:13: error: invalid types 'int[int]' for array subscript
   31 |         if(p[x].second>p[y].second) return 1;
      |             ^
plants.cpp:31:25: error: invalid types 'int[int]' for array subscript
   31 |         if(p[x].second>p[y].second) return 1;
      |                         ^