제출 #1060681

#제출 시각아이디문제언어결과실행 시간메모리
1060681vjudge1로봇 (IOI13_robots)C++17
0 / 100
3 ms8888 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int N=1000100; const int R=100000; int a,b,t; vector<int>x; vector<int>y; vector<int>w; vector<int>s; vector<pair<int,int>> WS; int binary(int mn, int md, int mx){ //priority_queue<pair<int,int>>pq; while(mx!=md){ //cout<<mn<<" "<<md<<" "<<mx<<endl; int pos=0; int cont=md; bool posible=true; for(int i=0;i<t;i++){ //cout<<w[i]<<" "<<x[pos]<<" WI XPOS"<<endl; if(w[i]>=x[pos]){ posible=false; break; } cont--; if(cont==0){ cont=md; pos++; } } if(posible==true){ mx=md; md=(mn+mx)/2; }else{ mn=md; md=(mn+mx+1)/2; } } return mx; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { if(B==0) return -1; a=A; b=B; t=T; for(int i=0;i<t;i++){ w.pb(W[i]); s.pb(S[i]); WS.pb({w[i],s[i]}); } for(int i=0;i<a;i++){ x.pb(X[i]); } for(int i=0;i<b;i++){ y.pb(Y[i]); } sort(w.rbegin(),w.rend()); sort(x.rbegin(),x.rend()); int answer=binary(1,(t+3)/2,t+2); if(answer>t) return -1; return answer; }
#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...