Submission #67007

#TimeUsernameProblemLanguageResultExecution timeMemory
67007nvmdavaTeams (IOI15_teams)C++17
Compilation error
0 ms0 KiB
#include "teams.h"
struct unit{
	int l, r;
	bool constructor<(const unit& rhs) const {
		if(l == rhs.l){
			return r < rhs.r;
		}
		return l < rhs.l;
	}
};

vector<unit> v;
void init(int N, int A[], int B[]) {
	unit t;
	for(int i = 0 ; i < N; i++){
		t.l = A[i];
		t.r = B[i];
		v.push_back(t);
	}
	sort(v.begin(), v.end());
}

int can(int M, int K[]) {
	vector<int> q;
	for(int i = 0; i < M; i++){
		q.push_back(K[i]);
	}
	sort(q.begin(), q.end());
	int i = 0, t = q[0];
	for(auto x : v){
		if(q[i] < x.l){
			return 0;
		}
		if(q[i] <= x.r){
			t--;
			if(t == 0){
				i++;
				if(i == M){
					return 1;
				}
			}
		}
	}
	return 0;
}

Compilation message (stderr)

teams.cpp:4:7: error: expected ';' at end of member declaration
  bool constructor<(const unit& rhs) const {
       ^~~~~~~~~~~
teams.cpp:4:18: error: expected unqualified-id before '<' token
  bool constructor<(const unit& rhs) const {
                  ^
teams.cpp:12:1: error: 'vector' does not name a type
 vector<unit> v;
 ^~~~~~
teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:18:3: error: 'v' was not declared in this scope
   v.push_back(t);
   ^
teams.cpp:20:7: error: 'v' was not declared in this scope
  sort(v.begin(), v.end());
       ^
teams.cpp:20:2: error: 'sort' was not declared in this scope
  sort(v.begin(), v.end());
  ^~~~
teams.cpp:20:2: note: suggested alternative: 'short'
  sort(v.begin(), v.end());
  ^~~~
  short
teams.cpp: In function 'int can(int, int*)':
teams.cpp:24:2: error: 'vector' was not declared in this scope
  vector<int> q;
  ^~~~~~
teams.cpp:24:9: error: expected primary-expression before 'int'
  vector<int> q;
         ^~~
teams.cpp:26:3: error: 'q' was not declared in this scope
   q.push_back(K[i]);
   ^
teams.cpp:28:7: error: 'q' was not declared in this scope
  sort(q.begin(), q.end());
       ^
teams.cpp:28:2: error: 'sort' was not declared in this scope
  sort(q.begin(), q.end());
  ^~~~
teams.cpp:28:2: note: suggested alternative: 'short'
  sort(q.begin(), q.end());
  ^~~~
  short
teams.cpp:30:15: error: 'v' was not declared in this scope
  for(auto x : v){
               ^