Submission #962753

#TimeUsernameProblemLanguageResultExecution timeMemory
962753simona1230Robots (IOI13_robots)C++17
0 / 100
101 ms16244 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; int a,b,t,x[50000],y[50000],w[50000],s[50000]; int putaway(int A,int B,int T,int X[],int Y[],int W[],int S[]) { a=A; b=B; t=T; for(int i=0;i<a;i++) x[i]=X[i]; for(int i=0;i<b;i++) y[i]=Y[i]; for(int i=0;i<t;i++) w[i]=W[i],s[i]=S[i]; sort(x,x+a); sort(y,y+b); if(a+b==2&&t==2) { if(a==2) { sort(w,w+t); if(x[0]>x[1])swap(x[0],x[1]); if(x[0]>w[0]&&x[1]>w[1])return 1; if(x[1]>w[1])return 2; return 0; } if(b==2) { sort(s,s+t); if(y[0]>y[1])swap(y[0],y[1]); if(y[0]>s[0]&&y[1]>s[1])return 1; if(y[1]>s[1])return 2; return 0; } if(x[0]>w[0]&&y[0]>s[1]||x[0]>w[1]&&y[0]>s[0])return 1; if(x[0]<w[0]&&y[0]<s[0]||x[0]<w[1]&&y[0]<s[1])return 0; return 2; } }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:40:21: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   40 |         if(x[0]>w[0]&&y[0]>s[1]||x[0]>w[1]&&y[0]>s[0])return 1;
      |            ~~~~~~~~~^~~~~~~~~~~
robots.cpp:41:21: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   41 |         if(x[0]<w[0]&&y[0]<s[0]||x[0]<w[1]&&y[0]<s[1])return 0;
      |            ~~~~~~~~~^~~~~~~~~~~
robots.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
#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...