# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1107083 | Aviansh | Teams (IOI15_teams) | C++17 | 4061 ms | 20008 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> nums[100005];
int nr;
void init(int n, int a[], int b[]) {
nr=n;
for(int i = 0;i<n;i++){
nums[a[i]].push_back(b[i]);
}
}
int can(int m, int k[]) {
int knum[100005];
fill(knum,knum+100005,0);
long long sm = 0;
for(int i = 0;i<m;i++){
knum[k[i]]++;
sm+=k[i];
}
if(sm>nr){
return 0;
}
priority_queue<int,vector<int>,greater<int>>pq;
for(int i = 0;i<100005;i++){
for(int e : nums[i]){
pq.push(e);
}
if(pq.size()<knum[i]*i){
return 0;
}
else{
for(int j = 0;j<knum[i];j++){
for(int k = 0;k<i;k++){
pq.pop();
}
}
}
while(pq.size()&&pq.top()==i){
pq.pop();
}
}
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |