# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1059190 | vjudge1 | Robots (IOI13_robots) | C++17 | 1 ms | 448 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "robots.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
vector<pair<int,int>> Tw, Ts;
for(int i=0; i < T; i++){
Tw.push_back({W[i],S[i]});
Ts.push_back({S[i],W[i]});
}
sort(Tw.rbegin(),Tw.rend());
sort(Ts.rbegin(),Ts.rend());
int r1=0,r2=0;
if(A == 2){
for(int i=0; i < T; i++){
if(Tw[i].first < X[0]){
r1++;
}
if(Tw[i].first < X[1]){
r2++;
}
}
}else if(B == 2){
for(int i=0; i < T; i++){
if(Ts[i].first < Y[0]){
r1++;
}
if(Ts[i].first < Y[1]){
r2++;
}
}
}else{
for(int i=0; i < T; i++){
if(Tw[i].first < X[0]){
r1++;
}
}
for(int i=0; i < T; i++){
if(Ts[i].first < Y[0]){
r2++;
}
}
}
int ans=-1;
if(r1 == 2 && r2 >= 1 || r2 == 2 && r1 >= 1){
ans = 1;
}else if(r1 == 1 && r2 == 1){
int a,b;
for(int i=0; i < T; i++){
if(Tw[i].first < X[0]){
a = i;
}
if(Tw[i].second < Y[0]){
b = i;
}
}
if(a != b){
ans = 1;
}else{
ans = 2;
}
}
return ans;
}
Compilation message (stderr)
# | 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... |