Submission #287207

#TimeUsernameProblemLanguageResultExecution timeMemory
287207AMO5Robots (IOI13_robots)C++17
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; #define fi first #define se second #define sz(x) (int)x.size() using ii = pair<int,int>; multiset<ii>ww,ss; //subtask 1 int putaway(int A,int B,int T, int X[],int Y[],int W[],int S[]){ for(int i=0; i<T; i++){ ww.insert({W[i],S[i]}); ss.insert({S[i],W[i]}); } sort(X,X+A); sort(Y,Y+B); for(int i=0; i<T; i++){ if(W[i]>X[A-1]&&S[i]>Y[B-1])return -1; } if(A+B==2&&T==2){ if(A==2){ if((ww.begin()->fi)>X[0])return 2; else return 1; }else if(A==1){ if((ww.begin()->se)<=Y[0]&&(ww.rbegin()->fi)<=X[0])return 1; else if((ww.begin()->fi)<=X[0]&&(ww.rbegin()->se)<=Y[0])return 1; else return 2; }else{ if((ss.begin()->fi)>Y[0])return 2; else return 1; } } return -1; } /* int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m,t; cin>>n>>m>>t; int x[n],y[m],w[t],s[t]; for(int i=0; i<n; i++)cin>>x[i]; for(int i=0; i<m; i++)cin>>y[i]; for(int i=0; i<t; i++) cin>>w[i]>>s[i]; cout<<putaway(n,m,t,x,y,w,s)<<endl; return 0; } // */ //check for -1 both w[i]&s[i] exceed largest x[i]&y[i]
#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...