Submission #959163

#TimeUsernameProblemLanguageResultExecution timeMemory
959163Mizo_CompilerTeams (IOI15_teams)C++17
34 / 100
4054 ms16976 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; typedef long long ll; typedef double ld; #define pb push_back #define sz(x) int32_t(x.size()) #define all(x) x.begin(),x.end() #define F first #define S second int n; vector<pair<int, int>> v; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) { v.pb({B[i], A[i]}); } sort(all(v)); } int can(int M, int K[]) { sort(K, K+M); int sm = 0; for (int i = 0; i < M; i++) { sm += K[i]; if (sm > n)return 0; } int id = 0, rem = K[0]; vector<bool> tk(n, false); while (id < M) { bool ff = false; for (int i = 0; i < n; i++) { if (tk[i])continue; if (v[i].S <= K[id] && v[i].F >= K[id]) { rem--; tk[i] = true; if (!rem) { id++; if (id < M)rem = K[id]; } ff = true; break; } } if (!ff)break; } return (id == M); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...