Submission #668537

#TimeUsernameProblemLanguageResultExecution timeMemory
668537LittleCubeTeams (IOI15_teams)C++14
0 / 100
4056 ms15960 KiB
#include "teams.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
using namespace std;

vector<pii> u, v;

void init(int N, int A[], int B[])
{
	for (int i = 0; i < N; i++)
		u.emplace_back(pii(A[i], B[i]));
}

int can(int M, int K[])
{
	v = u;
	priority_queue<int> pq;

	for (int i = 0; i < M; i++)
		v.emplace_back(pii(K[i], 1e9));
	sort(v.begin(), v.end());
	for (auto [L, R] : v)
	{
		if (R >= 1e8)
		{
			while (!pq.empty() && pq.top() < L)
				pq.pop();
			while (!pq.empty() && L > 0)
			{
				pq.pop();
				L--;
			}
			if (L)
				return 0;
		}
		else
			pq.push(R);
	}
	return 1;
}

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:24:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   24 |  for (auto [L, R] : v)
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...