Submission #1084911

#TimeUsernameProblemLanguageResultExecution timeMemory
1084911guagua0407Teams (IOI15_teams)C++17
0 / 100
4054 ms68208 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; vector<int> a,b; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<n;i++){ a.push_back(A[i]); b.push_back(B[i]); } } int can(int M, int K[]) { vector<vector<int>> st(n+1),en(n+1); for(int i=0;i<n;i++){ st[a[i]].push_back(i); en[b[i]].push_back(i); } set<pair<int,int>> S; int cnt=0; for(int i=1;i<=n;i++){ for(auto v:st[i]){ S.insert({b[v],v}); } while(cnt<M and K[cnt]==i){ for(int j=0;j<i;j++){ if(S.empty()){ return 0; } S.erase(S.begin()); } cnt++; } for(auto v:en[i]){ if(S.find({b[v],v})!=S.end()){ S.erase({b[v],v}); } } } 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...