Submission #592403

#TimeUsernameProblemLanguageResultExecution timeMemory
592403fuad27Robots (IOI13_robots)C++17
28 / 100
971 ms15388 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { if(A+B==2 and T == 2) { if(A and B) { if(S[0] < Y[0] and W[1] < X[0])return 1; if(S[1] < Y[0] and W[0] < X[0])return 1; if(S[0] < Y[0] and S[1] < Y[0])return 2; if(W[0] < X[0] and W[1] < X[0])return 2; return -1; } else if(B==2) { if(min(S[0],S[1]) < min(Y[0], Y[1]) and max(S[0], S[1]) < max(Y[0], Y[1])) { return 1; } if(min(S[0], S[1]) >= min(Y[0], Y[1]) and max(S[0], S[1]) < max(Y[0], Y[1]))return 2; return -1; } else if(A==2) { if(min(W[0],W[1]) < min(X[0], X[1]) and max(W[0], W[1]) < max(X[0], X[1])) { return 1; } if(min(W[0], W[1]) >= min(X[0], X[1]) and max(W[0], W[1]) < max(X[0], X[1]))return 2; return -1; } } else if(B == 0) { sort(X, X+A); int lo = 0, hi = 2*A; int res=-1; while(lo <= hi) { int mid = (lo+hi)/2; vector<int> v(A); for(int i = 0;i<T;i++) { int it = upper_bound(X, X+A, W[i])-X; if(it == A)return -1; v[it]++; } for(int i = 0;i<A-1;i++) { if(v[i] > mid) { v[i+1]+=v[i]-mid; v[i]=mid; } } if(v.back() > mid) { lo = mid+1; } else { res=mid; hi=mid-1; } } return res; } }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
   56 | }
      | ^
#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...