Submission #800620

#TimeUsernameProblemLanguageResultExecution timeMemory
800620firewaterTeams (IOI15_teams)C++14
34 / 100
4067 ms23000 KiB
#include "teams.h" #include<queue> #include <stdio.h> #include <stdlib.h> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define ll long long using namespace std; #define MX 500500 #define fs first #define sn second #define mp make_pair ll n,m,r,now,k[MX]; pair<ll,ll>a[MX]; priority_queue<ll>d; void init(int N, int A[], int B[]) { n=N; for(int i=1;i<=n;++i) a[i]=mp(A[i-1],B[i-1]); sort(a+1,a+1+n); return; } int can(int M, int K[]) { m=M; for(int i=1;i<=m;++i) k[i]=K[i-1]; sort(k+1,k+1+m); r=1; while(!d.empty())d.pop(); for(int i=1;i<=m;++i){ while(r<=n&&a[r].fs<=k[i]){ d.push(-a[r].sn); r++; } while(!d.empty()&&-d.top()<k[i])d.pop(); if(d.size()>=k[i]){ now=k[i]; while(now--)d.pop(); } else return 0; } return 1; }

Compilation message (stderr)

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