Submission #45830

#TimeUsernameProblemLanguageResultExecution timeMemory
45830RayaBurong25_1Teams (IOI15_teams)C++17
34 / 100
4032 ms18224 KiB
//stupid solution to just get some points #include "teams.h" #include <algorithm> #include <vector> #include <queue> #include <stdio.h> typedef struct point point; struct point { int a, b; }; int n; std::vector<point> P; int sortAB(point a, point b) { return (a.a < b.a || (a.a == b.a && a.b < b.b)); } void init(int N, int A[], int B[]) { n = N; int i; for (i = 0; i < N; i++) P.push_back({A[i], B[i]}); std::sort(P.begin(), P.end(), sortAB); } std::priority_queue<int> PQ; int can(int M, int K[]) { while (!PQ.empty()) PQ.pop(); std::sort(&K[0], &K[M]); int i, j = 0, k; for (i = 0; i < M; i++) { while (j < n && P[j].a <= K[i]) { PQ.push(-P[j].b); // printf("push %d\n", P[j].b); j++; } for (k = 0; k < K[i]; k++) { while (PQ.size() > 0 && -PQ.top() < K[i]) { // printf("//pop %d\n", -PQ.top()); PQ.pop(); } if (PQ.size() > 0) { // printf("pop %d\n", -PQ.top()); PQ.pop(); } else return 0; } } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...