제출 #398069

#제출 시각아이디문제언어결과실행 시간메모리
398069MeGustaElArroz23팀들 (IOI15_teams)C++14
34 / 100
4088 ms20120 KiB

#include "teams.h"
#include<bits/stdc++.h>


using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;

//init(N, A, B) — The grader will call this function first and exactly once.

//can(M, K) — After calling init once, the grader will call this function  times in a row, once for each day.

vii v;
ll n;

void init(int x, int a[], int b[]){
    n=x;
    v=vii(n);
    for (ll i=0;i<n;i++){
        v[i]=pii{a[i],b[i]};
    }
    sort(v.begin(),v.end());
}
int can(int m, int k[]){
    vi q(m);
    for (ll i=0;i<m;i++) q[i]=k[i];
    sort(q.begin(),q.end());
    priority_queue<ll> cola;
    ll i=0;
    for (ll j=0;j<m;j++){
        ll s=q[j];
        while (i<n and v[i].first<=s){
            cola.push(-v[i].second);
            i++;
        }
        while (cola.size()>0 and -cola.top()<s) cola.pop();
        if (cola.size()>=s){
            for (ll h=0;h<s;h++) cola.pop();
        }
        else return 0;
    }
    return 1;
}

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'int can(int, int*)':
teams.cpp:41:24: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   41 |         if (cola.size()>=s){
      |             ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...