# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
802299 | Khizri | Teams (IOI15_teams) | C++17 | 4067 ms | 18212 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;
#define ll long long
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
const int mxn=2e5+5;
int n,x[mxn],y[mxn];
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<n;i++){
x[i+1]=A[i];
y[i+1]=B[i];
}
}
bool cmp(pii a,pii b){
if(a.S==b.S){
return a.F>b.F;
}
return a.S<b.S;
}
int can(int m, int arr[]) {
sort(arr+1,arr+m+1);
vector<pii>vt;
for(int i=1;i<=n;i++){
vt.pb({x[i],y[i]});
}
ll sum=0;
for(int i=0;i<m;i++){
sum+=arr[i];
}
if(sum>n) return 0;
sort(all(vt));
for(int i=0;i<m;i++){
int cnt=arr[i];
for(int j=0;j<vt.size();j++){
if(!cnt) break;
if(vt[j].F<=arr[i]&&vt[j].S>=arr[i]){
vt.erase(vt.begin()+j);
j--;
cnt--;
}
}
if(cnt) return 0;
}
return 1;
}
/*
g++ teams.cpp grader.cpp ; .\a.exe
*/
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... |