# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741629 | MODDI | Teams (IOI15_teams) | C++14 | 128 ms | 23088 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 "grader.cpp"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
using namespace std;
vector<pii> arr;
bool comp(pii& a, pii& b){
if(a.first < b.first) return true;
else if(a.first > b.first) return false;
else{
if(b.first < a.first) return false;
return true;
}
}
void init(int N, int A[], int B[]) {
for(int i = 0; i < N; i++){
arr.pb(mp(A[i], B[i]));
}
sort(arr.begin(), arr.end(), comp);
}
int can(int M, int K[]) {
vector<int> teams;
for(int i = 0; i < M; i++)
teams.pb(K[i]);
sort(teams.begin(), teams.end());
int j = 0;
for(int i = 0; i < teams.size(); j++){
int in = 0;
while(in < teams[i]){
if(arr[j].second < teams[i]){
j++;
if(j == arr.size()) return 0;
}
else if(arr[j].first <= teams[i]){
in++;
j++;
if(j == arr.size() && in < teams[i]) return 0;
}
else if(arr[j].first > teams[i]){
return 0;
}
}
}
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... |