Submission #298923

#TimeUsernameProblemLanguageResultExecution timeMemory
298923BlancaHMTeams (IOI15_teams)C++17
Compilation error
0 ms0 KiB
#include <iostream>
#include <fstream>
#include <cfloat>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>
#include <cmath>
#include <climits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<string> vs;
#define fir first
#define sec second
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()

int N, M;
vpii pref;
vi K;

int can() {
	int i = 0, j = 0, inc;
	bool pos;
	while(i < N && j < M) {
		if (pref[i].first > K[j]) return 0;
		if (pref[i].second >= K[j]) {
			pos = true;
			inc = i+1;
			for (int n = j+1; n < j+K[j]; n++) {
				if (pref[n].second >= K[j]) inc = n+1;
				else {
					pos = false;
					break;
				}
			}
			i = inc;
			if (pos) j++;
		} else i++;
	}
	return j == M;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> N;
	pref = vpii(N, pii());
	for (int i = 0; i < N; i++) cin >> pref[i].first >> pref[i].second;
	sort(pref.begin(), pref.end());
	int Q;
	cin >> Q;
	while(Q--) {
		cin >> M;
		K = vi(M);
		for (int i = 0; i < M; i++) cin >> K[i];
		sort(K.begin(), K.end());
		cout << can() << "\n";
	}
	return 0;
}

Compilation message (stderr)

/tmp/cc882rsX.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccOJONGj.o:teams.cpp:(.text.startup+0x0): first defined here
/tmp/cc882rsX.o: In function `main':
grader.c:(.text.startup+0x353): undefined reference to `init(int, int*, int*)'
grader.c:(.text.startup+0x696): undefined reference to `can(int, int*)'
collect2: error: ld returned 1 exit status