제출 #1059070

#제출 시각아이디문제언어결과실행 시간메모리
1059070vjudge1로봇 (IOI13_robots)C++17
0 / 100
2 ms8284 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; /* int solve(int a, int b, int pos_A, int pos_B){ for } */ int visitados[1000000]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { memset(visitados,0,sizeof(visitados)); int botactive=A+B; bool isweak=true; int pos=0; int cont=0; int time=0; while(botactive>0 && cont<T){ //cout<<cont<<" cont"<<endl; //cout<<pos<<" pos, isweak:"<<isweak<<endl; if(isweak==true){ int currentW=-1; int currentpos=-1; if(X[pos]!=-1){ for(int i=0;i<T;i++){ if(visitados[i]==0 && W[i]<X[pos]){ if(W[i]>currentW){ currentW=W[i]; currentpos=i; }else if(W[i]==currentW){ if(S[i]>S[currentpos]){ currentW=W[i]; currentpos=i; } } } } }else{ pos++; } if(currentpos!=-1){ visitados[currentpos]=1; pos++; cont++; }else{ X[pos]=-1; botactive--; pos++; } if(pos==A){ isweak=false; pos=0; } }else{ int currentS=-1; int currentpos=-1; if(S[pos]!=-1){ for(int i=0;i<T;i++){ if(visitados[i]==0 && S[i]<Y[pos]){ if(S[i]>currentS){ currentS=S[i]; currentpos=i; }else if(S[i]==currentS){ if(S[i]>S[currentpos]){ currentS=S[i]; currentpos=i; } } } } }else{ pos++; } if(currentpos!=-1){ visitados[currentpos]=1; pos++; cont++; }else{ X[pos]=-1; pos++; botactive--; } if(pos==B){ isweak=true; pos=0; time++; } } } if(cont<T){ return -1; }else{ return time; } }
#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...