Submission #361326

#TimeUsernameProblemLanguageResultExecution timeMemory
361326bigDuckRobots (IOI13_robots)C++14
0 / 100
78 ms65540 KiB
#include<bits/stdc++.h> using namespace std; #define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define mp make_pair #define pb push_back #define ft first #define sc second #define ll long long #define pii pair<int, int> #define count_bits __builtin_popcount #include "robots.h" int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X+A); sort(Y, Y+B); vector<pii> pr; for(int i=0; i<T; i++){ pr.pb({W[i], S[i]}); } sort(pr.begin(), pr.end()); int l=1, r=T+1, mid=(l+r)>>1ll; while(l<r){ mid=(l+r)>>1ll; vector<pii> ac; int cr=0; for(int i=0; i<A; i++){ while((cr<pr.size()) && (pr[cr].ft<X[i]) ){ ac.pb(pr[cr]); cr++; } for(int j=0; (j<mid) && (ac.size()>0); j++){ ac.pop_back(); } } for(int i=cr; i<pr.size(); i++){ ac.pb(pr[cr]); } for(int i=0; i<ac.size(); i++){ swap(ac[i].ft, ac[i].sc); } sort(ac.begin(), ac.end()); vector<pii> ac2; cr=0; for(int i=0; i<B ;i++){ while( (cr<ac.size()) && (ac[cr].ft<Y[i]) ){ ac2.pb(ac[cr]); } for(int j=0; (j<mid) && (ac2.size()>0); j++ ){ ac2.pop_back(); } } if(ac2.size()==0){ r=mid; } else{ l=(mid+1); } mid=(l+r)>>1ll; } if(mid>T){ return -1; } return mid; }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:32:22: 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((cr<pr.size()) && (pr[cr].ft<X[i]) ){
      |                    ~~^~~~~~~~~~
robots.cpp:40:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int i=cr; i<pr.size(); i++){
      |                       ~^~~~~~~~~~
robots.cpp:44: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]
   44 |         for(int i=0; i<ac.size(); i++){
      |                      ~^~~~~~~~~~
robots.cpp:52: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]
   52 |             while( (cr<ac.size()) && (ac[cr].ft<Y[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...