Submission #993174

#TimeUsernameProblemLanguageResultExecution timeMemory
993174MrDebooRobots (IOI13_robots)C++17
0 / 100
1 ms4444 KiB
#include "robots.h" #include "bits/stdc++.h" using namespace std; vector<pair<int,int>>v; void 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[i].first){ pq.push({v[i].second,v[i].first}); l++; } if(pq.size()){ 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); } } 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]); int sz=t+1,cnt=0; while(v.size()&&sz!=v.size()){ cnt++; sz=v.size(); sort(v.begin(),v.end()); slv(a); for(auto &i:v)swap(i.first,i.second); sort(v.begin(),v.end()); slv(b); for(auto &i:v)swap(i.first,i.second); } if(v.size())cnt=-1; return cnt; }

Compilation message (stderr)

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