| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 42230 | yusufake | Teams (IOI15_teams) | C++98 | 4101 ms | 41924 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.
/*
ID: ekrem
LANG: C++
TASK: teams
*/
#include <algorithm>
#include <iostream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
// #include "teams.h"
using namespace std;
#define foreach(kk,gg) for(__typeof(gg.begin())kk=gg.begin();kk!=gg.end();kk++)
#define dbgs(x) cerr << (#x) << " --> " << (x) << ' '
#define dbg(x) cerr << (#x) << " --> " << (x) << endl
#define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++)
#define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--)
#define SET(a, b) memset(a, b, sizeof a)
#define heap priority_queue
#define orta (bas+son>>1)
#define endll puts("")
#define mp make_pair
#define pb push_back
#define sag (k+k+1)
#define sol (k+k)
#define endl '\n'
#define nd second
#define st first
#define y1 ekrem
#define y2 merke
typedef int don;
#define int long long int
inline don read(){don x;scanf(" %d",&x);return x;}
typedef pair < int , int > ii;
typedef vector < int > vi;
typedef vector < ii > vii;
const int inf = 1e9 + 7;
const int linf = 1e18 + 7;
const int NMAX = 5e5 + 5;
don N, A[NMAX], B[NMAX], Q, M, K[NMAX];
int n, h[NMAX];
vi g[NMAX];
multiset < int > s;
don can(don M, don K[]){
SET(h, 0);
FOR(i, 0, M - 1)
h[K[i]] += K[i];
s.clear();
FOR(i, 1, n){
foreach(k, g[i])
s.insert(*k);
if(h[i]){
int say = h[i];
while(say and !s.empty()){
s.erase(s.begin());
say--;
}
if(say)
return 0;
}
while(s.count(i))
s.erase(i);
}
return 1;
}
void init(don N, don A[], don B[]){
n = N;
FOR(i, 0, N - 1)
g[A[i]].pb(B[i]);
}
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... | ||||
