이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |