제출 #134580

#제출 시각아이디문제언어결과실행 시간메모리
134580Boxworld팀들 (IOI15_teams)C++14
0 / 100
4042 ms18064 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; struct S{int l,r;}a[500100]; int n; void init(int N, int A[], int B[]){ n=N; for (int i=0;i<N;i++)a[i].l=A[i],a[i].r=B[i]; } int can(int M, int K[]){ printf("New_Day\n"); priority_queue<P,vector<P>,greater<P> >Q; sort(K,K+M); for (int i=0;i<n;i++)Q.push(make_pair(a[i].l,a[i].r)); while(Q.top().first<K[0]){ P x=Q.top(); Q.pop(); if (K[0]<=x.second){ Q.push(make_pair(K[0],x.second)); printf("NEW l:%d r:%d\n",K[0],x.second); } if (Q.empty())break; } for (int i=0;i<M;i++){ if (Q.empty())return 0; if (Q.size()<K[i])return 0; for (int j=0;j<K[i];j++){ P x=Q.top(); printf("Work[%d] l:%d r:%d\n",K[i],x.first,x.second); Q.pop(); if (x.first<=K[i]&&K[i]<=x.second)continue; else return 0; } if (i==M-1)return 1; while(Q.top().first<K[i+1]){ P x=Q.top(); Q.pop(); if (K[i+1]<=x.second){ Q.push(make_pair(K[i+1],x.second)); printf("NEW l:%d r:%d\n",K[i+1],x.second); } if (Q.empty())break; } } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:27:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (Q.size()<K[i])return 0;
             ~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...