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 <bits/stdc++.h>
#define ll long long
#define longlonginf LONG_LONG_MAX
#define inf INT_MAX
#include "robots.h"
using namespace std;
ll n,m;
ll l,r;
string s;
//x = weight limit
//y = size limit
//{weight,size}
bool can(pair<int,int> x,pair<int,int> y){
if( x.first == 0 ){
if( y.first < x.second ) return 1;
}
else{
if( y.second < x.second ) return 1;
}
return 0;
}
int putaway(int a,int b,int t,int x[],int y[],int w[],int s[]){
//convert to a single array
vector<pair<int,int>> v;
for(int i = 0 ; i < a ; i++ ) v.push_back({0,x[i]});
for(int i = 0 ; i < b ; i++ ) v.push_back({1,y[i]});
vector<pair<int,int>> toys;
for(int i = 0 ; i < t ; i++){
toys.push_back({w[i],s[i]});
}
if( t == 2 && a+b == 2 ){
ll ans = inf;
if( can(v[0],toys[0]) && can(v[0],toys[1]) ) ans = min(ans,(ll)2);
if( can(v[1],toys[0]) && can(v[1],toys[1]) ) ans = min(ans,(ll)2);
if( can(v[0],toys[0]) && can(v[1],toys[1]) ) ans = min(ans,(ll)1);
if( can(v[1],toys[0]) && can(v[0],toys[1]) ) ans = min(ans,(ll)1);
if( ans == inf) return -1;
else return ans;
}
return 0;
}
//~ int main(){
//~ int T = 1;
//~ //cin>>T;
//~ for(int i = 1 ; i <= T ; i++){
//~ solve();
//~ }
//~ return 0;
//~ }
# | 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... |