Submission #288950

#TimeUsernameProblemLanguageResultExecution timeMemory
288950BertedTeams (IOI15_teams)C++14
0 / 100
36 ms8312 KiB
#include "teams.h" #include <iostream> #include <utility> #include <algorithm> #include <vector> #include <bitset> #define pii pair<int, int> #define fst first #define snd second const int SZ = (1 << 20) + 5, SZ2 = 500005; using namespace std; struct p_node { int v = 0, l = -1, r = -1; p_node() {} }; int n; pii a[101]; int pref[101], suf[101], t[101]; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < N; i++) {a[i] = {A[i], B[i]}; pref[B[i]]++; suf[A[i]]++;} for (int i = 1; i <= n + 1; i++) {pref[i] += pref[i - 1];} for (int i = n; i >= 0; i--) {suf[i] += suf[i + 1];} } int can(int M, int K[]) { //cout << "New " << M << "\n"; sort(K, K + M); int ret = 1; for (int i = 0; i < M; i++) { if (i) { int add = 0; for (int j = 0; j < n; j++) { if (K[i - 1] < a[j].fst && a[j].snd < K[i]) {add++;} } for (int j = 1; j <= K[i - 1]; j++) {t[j] += add;} } for (int j = 1; j <= K[i]; j++) {t[j] += K[i];} for (int j = 1; j <= K[i]; j++) { cout << i << " " << j << " " << pref[j - 1] << " " << suf[K[i] + 1] << " " << t[j] << "\n"; if (pref[j - 1] + suf[K[i] + 1] + t[j] > n) {ret = 0;} } } for (int i = 1; i <= n; i++) {t[i] = 0;} return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...