Submission #358652

# Submission time Handle Problem Language Result Execution time Memory
358652 2021-01-26T04:13:18 Z talant117408 Teams (IOI15_teams) C++17
0 / 100
103 ms 11860 KB
#include "teams.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;

int n;
vector <pii> ranges;

void init(int N, int A[], int B[]){
    n = N;
    for(int i = 0; i < N; i++){
        ranges.pb(mp(A[i], B[i]));
    }
    sort(all(ranges));
}

int can(int M, int K[]){
    sort(K, K+M);
    ll sum = 0;
    for(int i = 0; i < M; i++) sum += K[i];
    if(sum > n) return 0;
    
    int j = 0;
    for(int i = 0; i < M; i++){
        int q = K[i];
        while(q){
            while(j < n && !(ranges[j].first <= K[i] && K[i] <= ranges[j].second)) j++;
            if(j == n){
                return 1;
            }
            q--;
            j++;
        }
    }
    
	return 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 3428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 3556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 11860 KB Output isn't correct
2 Halted 0 ms 0 KB -