# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
778264 | Jarif_Rahman | Teams (IOI15_teams) | C++17 | 4080 ms | 28816 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int n;
int *A, *B;
void init(int _n, int _A[], int _B[]){
swap(n, _n);
swap(A, _A);
swap(B, _B);
}
int can(int m, int K[]){
vector<vector<int>> rl(n+1);
for(int i = 0; i < n; i++) rl[A[i]].pb(i);
vector<int> projects(n+1, 0);
for(int i = 0; i < m; i++) projects[K[i]]++;
priority_queue<int, vector<int>, greater<int>> pq;
for(int i = 1; i <= n; i++){
for(int j: rl[i]) pq.push(B[j]);
int k = projects[i]*i;
if(k > pq.size()) return 0;
while(k--) pq.pop();
while(!pq.empty() && 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... |