Submission #803025

#TimeUsernameProblemLanguageResultExecution timeMemory
803025LiudasTeams (IOI15_teams)C++17
34 / 100
4089 ms8956 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; vector<pair<int, int>> arr; vector<bool> taken; int N; void init(int K, int A[], int B[]){ N = K; for(int i = 0; i < N; i ++){ arr.push_back({A[i], B[i]}); } taken.resize(N); sort(arr.begin(), arr.end()); sort(arr.begin(), arr.end(), [](pair<int,int> a, pair<int,int>b){return a.second < b.second;}); } int can(int M, int K[]){ fill(taken.begin(), taken.end(), false); sort(K, K + M); for(int i = 0; i < M; i ++){ int need = K[i]; int id = 0; int got = 0; while(id < N && got < need){ if(!taken[id] && arr[id].first <= need && arr[id].second >= need){ got++; taken[id] = true; } id++; } if(got < need){ 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...