Submission #1082100

# Submission time Handle Problem Language Result Execution time Memory
1082100 2024-08-30T17:13:46 Z Malix Teams (IOI15_teams) C++14
34 / 100
4000 ms 12240 KB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;
 
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define LSOne(s) ((s)&(-s))
 
ll INF=1000000000000000010;
int inf=1e9+10;
ll M=1e9+7;

pii a;
int n;

void init(int N, int A[], int B[]) {
	n=N;
	REP(i,0,n)a.PB({A[i],B[i]});
	sort(a.begin(),a.end());
}

int can(int m, int K[]) {
	vi b;
	REP(i,0,m)b.PB(K[i]);
	sort(b.begin(),b.end());
	priority_queue<int,vi,greater<int>> pq;
	int pos=0;
	REP(i,0,m){
		while(!pq.empty()&&pq.top()<b[i])pq.pop();
		while(pos<n&&a[pos].F<=b[i]){
			pq.push(a[pos].S);
			pos++;
		}
		while(!pq.empty()&&pq.top()<b[i])pq.pop();
		while(b[i]>0){
			if(pq.empty())return 0;
			pq.pop();
			b[i]--;
		}
	}
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 440 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 440 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 2260 KB Output is correct
2 Correct 14 ms 2216 KB Output is correct
3 Correct 23 ms 2768 KB Output is correct
4 Correct 16 ms 3280 KB Output is correct
5 Correct 10 ms 2260 KB Output is correct
6 Correct 11 ms 2260 KB Output is correct
7 Correct 10 ms 2260 KB Output is correct
8 Correct 10 ms 2252 KB Output is correct
9 Correct 13 ms 3020 KB Output is correct
10 Correct 8 ms 3536 KB Output is correct
11 Correct 8 ms 3280 KB Output is correct
12 Correct 10 ms 3596 KB Output is correct
13 Correct 15 ms 3444 KB Output is correct
14 Correct 15 ms 3784 KB Output is correct
15 Correct 14 ms 3284 KB Output is correct
16 Correct 13 ms 3284 KB Output is correct
17 Correct 13 ms 3284 KB Output is correct
18 Correct 14 ms 3460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2256 KB Output is correct
2 Correct 19 ms 2256 KB Output is correct
3 Execution timed out 4067 ms 2920 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 82 ms 9164 KB Output is correct
2 Correct 79 ms 8892 KB Output is correct
3 Execution timed out 4059 ms 12240 KB Time limit exceeded
4 Halted 0 ms 0 KB -