제출 #993382

#제출 시각아이디문제언어결과실행 시간메모리
993382MrM7md로봇 (IOI13_robots)C++17
0 / 100
1 ms444 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; // #define int long long #define endl '\n' #define F first #define S second #define pb push_back #define all(a) a.begin(),a.end() const int NN=1e6+50000; const int MOD=1e9+7; const int off=(1<<11); int putaway(int A,int B,int T,int X[],int Y[],int W[],int S[]){ int l=0,r=T; int ans=-1; while(l<r){ int md=(l+r)/2; vector<pair<int,pair<int,int>>>vec; for(int i=0;i<T;i++)vec.pb({W[i],{1,i}}); for(int i=0;i<A;i++)vec.pb({X[i],{0,i}}); priority_queue<pair<int,int>> pq; sort(all(vec)); for(int i=0;i<vec.size();i++){ if(vec[i].S.F==1){ pq.push({S[vec[i].S.S],1}); } else{ int gg=md; while(gg--){ if(pq.empty())break; pq.pop(); } } } vector<pair<int,int>>vc; for(int i=0;i<B;i++)vc.pb({Y[i],0}); while(pq.size()){ vc.pb(pq.top()); pq.pop(); } sort(all(vc)); int cnt=0; for(int i=0;i<vc.size();i++){ if(vc[i].S==1){ cnt++; } else{ cnt=max(cnt-md,0); } } if(cnt){ l=md+1; } else{ ans=md; // cout<<md<<endl; r=md; } } return ans; } // signed main(){ // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for(int i=0;i<vec.size();i++){
      |                     ~^~~~~~~~~~~
robots.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         for(int i=0;i<vc.size();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...
#Verdict Execution timeMemoryGrader output
Fetching results...