# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242868 | godwind | Teams (IOI15_teams) | C++14 | 4101 ms | 9976 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <functional>
using namespace std;
const int N = 100 * 1000 + 228;
int n;
int a[N], b[N];
bool used[N];
void init(int N, int A[], int B[]) {
n = N;
for (int i = 0; i < n; ++i) {
a[i] = A[i];
b[i] = B[i];
}
}
int can(int M, int K[]) {
for (int i = 0; i < n; ++i) {
used[i] = 0;
}
int sum_all = 0;
for (int i = 0; i < M; ++i) {
sum_all += K[i];
if (sum_all > n) {
return 0;
}
}
sort(K, K + M);
for (int xxx = 0; xxx < M; ++xxx) {
int S = K[xxx];
for (int it = 0; it < S; ++it) {
int opt = -1;
for (int i = 0; i < n; ++i) {
if (a[i] <= S && S <= b[i] && !used[i]) {
if (opt == -1) {
opt = i;
} else {
if (b[i] < b[opt]) {
opt = i;
}
}
}
}
if (opt == -1) return 0;
used[opt] = 1;
}
}
return 1;
}
Compilation message (stderr)
# | 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... |