제출 #993211

#제출 시각아이디문제언어결과실행 시간메모리
993211MrDeboo로봇 (IOI13_robots)C++17
76 / 100
3097 ms53940 KiB
#include "robots.h" #include "bits/stdc++.h" using namespace std; vector<pair<int,int>>v; int mid; bool slv(deque<int>dq){ map<pair<int,int>,int>mp; priority_queue<pair<int,int>>pq; int l=0; for(int i=0;i<dq.size();i++){ while(l<v.size()&&dq[i]>v[l].first){ pq.push({v[l].second,v[l].first}); l++; } int k=mid; while(pq.size()&&k--){ mp[{pq.top().second,pq.top().first}]++; pq.pop(); } } vector<pair<int,int>>vec; for(auto &i:v){ if(mp[i]){ mp[i]--; }else vec.push_back(i); } v=vec; return vec.empty(); } int putaway(int A, int B, int t, int x[], int y[], int w[], int s[]) { for(int i=0;i<t;i++)v.push_back({w[i],s[i]}); deque<int>a,b; for(int i=0;i<A;i++)a.push_back(x[i]); for(int i=0;i<B;i++)b.push_back(y[i]); sort(a.begin(),a.end()); sort(b.begin(),b.end()); int l=0,r=t,f=-1; vector<pair<int,int>>vec=v; while(l<=r){ mid=(l+r)/2; v=vec; sort(v.begin(),v.end()); slv(a); for(auto &i:v)swap(i.first,i.second); sort(v.begin(),v.end()); bool bl=slv(b); for(auto &i:v)swap(i.first,i.second); if(bl){ r=mid-1; f=mid; }else l=mid+1; } return f; }

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

robots.cpp: In function 'bool slv(std::deque<int>)':
robots.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=0;i<dq.size();i++){
      |                 ~^~~~~~~~~~
robots.cpp:11:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         while(l<v.size()&&dq[i]>v[l].first){
      |               ~^~~~~~~~~
#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...