답안 #20197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20197 2016-03-12T12:18:11 Z magic_fate 팀들 (IOI15_teams) C++
0 / 100
4078 ms 32 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 500000 + 10;
const int MAX_M = 500000 + 10;

int bk_sz;
int M , K[MAX_M];
int N , A[MAX_N] , B[MAX_N];

void init(int N0 , int A0[] , int B0[]) {
    N = N0;
    for(int i = 0; i < N; i++) {
        A[i] = A0[i];
        B[i] = B0[i];
    }

    bk_sz = (int)sqrt(N);
}

int solve1() {
    priority_queue<int> pq;
    vector<pair<int,int> > v_pii;

    for(int i = 0; i < N; i++) v_pii.push_back(make_pair(A[i] , B[i]));

    sort(v_pii.begin() , v_pii.end());

    for(int i = 0 , j = 0; i < M; i++) {
        while(!pq.empty() && pq.top() < K[i]) pq.pop();
        while(j < N && v_pii[j].first == i) pq.push(v_pii[j++].second);

        int x = K[i];

        while(x && !pq.empty()) {
            pq.pop();
            x--;
        }

        if(x) return 0;
    }

    return 1;
}

int can(int M0 , int K0[]) {
    M = M0;
    for(int i = 0; i < M; i++) K[i] = K0[i];

    sort(K , K + M);

    return solve1();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 0 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 4 KB Output is correct
2 Correct 20 ms 5 KB Output is correct
3 Correct 20 ms 6 KB Output is correct
4 Correct 22 ms 8 KB Output is correct
5 Incorrect 16 ms 8 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2737 ms 11 KB Output is correct
2 Correct 3120 ms 12 KB Output is correct
3 Execution timed out 4078 ms 13 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4078 ms 32 KB Time limit exceeded
2 Halted 0 ms 0 KB -