이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 25;
const int SZE = 400;
int n;
array <int, 2> a[MAXN];
void init(int N, int A[], int B[]) {
	n = N;
	for (int i = 0; i < n; i++) {
		a[i][0] = A[i];
	}
	for (int i = 0; i < n; i++) {
		a[i][1] = B[i];
	}
	sort(a, a + n);
}
vector <array <int, 3>> ee[MAXN];
int query (int x1, int y1, int x2, int y2) {
	int ret = 0;
	for (int i = 1; i <= n; i++) {
		ret += (a[i][0] >= x1 && a[i][0] <= x2 && a[i][1] >= y1 && a[i][1] <= y2);
	}
	return ret;
}
int can (int m, int k[]) {
	int sum = 0;
	for (int i = 0; i < m; i++) {
		sum += k[i];
		if (sum > n) {
			return 0;
		}
	}
	sort(k, k + m);
	if (m >= SZE) {
		for (int i = 1; i <= n; i++) {
			ee[i].clear();
		}
		for (int i = 0; i < n; i++) {
			ee[a[i][0]].push_back({a[i][1], i, 1});
			ee[a[i][1] + 1].push_back({a[i][1], i, -1});
		}
		int ptr = 1;
		set <array <int, 2>> cur;
		for (int i = 0; i < m; i++) {
			while (ptr <= k[i]) {
				for (auto j : ee[ptr]) {
					if (j[2] == 1) {
						cur.insert({j[0], j[1]});
					} else {
						cur.erase({j[0], j[1]});
					}
				}
				ptr++;
			}
			if (cur.size() < k[i]) {
				return 0;
			}
			for (int j = 0; j < k[i]; j++) {
				cur.erase(cur.begin());
			}
		}
		return 1;
	}
	int dp[m + 1] = {};
	for (int i = 1; i <= m; i++) {
		dp[i] = query(1, k[i - 1], k[i - 1], n);
		for (int j = 1; j < i; j++) {
			dp[i] = max(dp[i], dp[j] + query(k[j - 1] + 1, k[i - 1], k[i - 1], n));
		}
		dp[i] -= k[i - 1];
	}
	return dp[m] >= 0;
}
컴파일 시 표준 에러 (stderr) 메시지
teams.cpp: In function 'int can(int, int*)':
teams.cpp:56:19: warning: comparison of integer expressions of different signedness: 'std::set<std::array<int, 2> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   56 |    if (cur.size() < k[i]) {
      |        ~~~~~~~~~~~^~~~~~| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |