Submission #740074

# Submission time Handle Problem Language Result Execution time Memory
740074 2023-05-12T05:18:16 Z vjudge1 Fountain Parks (IOI21_parks) C++17
Compilation error
0 ms 0 KB
#include "parks.h"
const int maxn = 2e5 + 100;
int ord[maxn];
vector<int>x, y;

int construct_roads() {
    if (x.size() == 1) {
	build({}, {}, {}, {});
        return 1;
    }
    for(int i=0; i<n; i++){
    	ord[i] = i;
	}
	sort(ord, ord+n, [](int a, int b){
		return y[a] < y[b];
	});
	bool ok = 1;
	vector<int>u, v, a, b;
	for(int i=1; i<n; i++){
		if(y[i]-y[i-1] != 2) ok = 0;
		u.push_back(ord[i-1]);
		v.push_back(ord[i]);
		a.push_back(1);
		b.push_back(y[ord[i]]-1);
	}
	if(ok) build(u, v, a, b);
    return ok;
}

Compilation message

parks.cpp:4:1: error: 'vector' does not name a type
    4 | vector<int>x, y;
      | ^~~~~~
parks.cpp: In function 'int construct_roads()':
parks.cpp:7:9: error: 'x' was not declared in this scope
    7 |     if (x.size() == 1) {
      |         ^
parks.cpp:11:20: error: 'n' was not declared in this scope
   11 |     for(int i=0; i<n; i++){
      |                    ^
parks.cpp:14:16: error: 'n' was not declared in this scope
   14 |  sort(ord, ord+n, [](int a, int b){
      |                ^
parks.cpp: In lambda function:
parks.cpp:15:10: error: 'y' was not declared in this scope
   15 |   return y[a] < y[b];
      |          ^
parks.cpp: In function 'int construct_roads()':
parks.cpp:14:2: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |  sort(ord, ord+n, [](int a, int b){
      |  ^~~~
      |  short
parks.cpp:18:2: error: 'vector' was not declared in this scope
   18 |  vector<int>u, v, a, b;
      |  ^~~~~~
parks.cpp:18:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from parks.h:1,
                 from parks.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from parks.h:1,
                 from parks.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
parks.cpp:18:9: error: expected primary-expression before 'int'
   18 |  vector<int>u, v, a, b;
      |         ^~~
parks.cpp:20:6: error: 'y' was not declared in this scope
   20 |   if(y[i]-y[i-1] != 2) ok = 0;
      |      ^
parks.cpp:21:3: error: 'u' was not declared in this scope
   21 |   u.push_back(ord[i-1]);
      |   ^
parks.cpp:22:3: error: 'v' was not declared in this scope
   22 |   v.push_back(ord[i]);
      |   ^
parks.cpp:23:3: error: 'a' was not declared in this scope
   23 |   a.push_back(1);
      |   ^
parks.cpp:24:3: error: 'b' was not declared in this scope
   24 |   b.push_back(y[ord[i]]-1);
      |   ^
parks.cpp:24:15: error: 'y' was not declared in this scope
   24 |   b.push_back(y[ord[i]]-1);
      |               ^
parks.cpp:26:15: error: 'u' was not declared in this scope
   26 |  if(ok) build(u, v, a, b);
      |               ^
parks.cpp:26:18: error: 'v' was not declared in this scope
   26 |  if(ok) build(u, v, a, b);
      |                  ^
parks.cpp:26:21: error: 'a' was not declared in this scope
   26 |  if(ok) build(u, v, a, b);
      |                     ^
parks.cpp:26:24: error: 'b' was not declared in this scope
   26 |  if(ok) build(u, v, a, b);
      |                        ^