Submission #309343

#TimeUsernameProblemLanguageResultExecution timeMemory
309343amunduzbaevRobots (IOI13_robots)C++14
0 / 100
1 ms512 KiB
#include "robots.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;

const int N=1e4+5;

int putaway(int wet, int smt, int T, int we[], int sm[], int wt[], int st[]) {
    int t=T;
    if(t==2){
        sort(we,we+wet);
        sort(sm,sm+smt);
        for(int i=0;i<t;i++){
                //cout<<wt[i]<<" "<<st[i]<<"\n";
            if(wt[i]>we[wet-1]&&st[i]>sm[smt-1]) return -1;
        }
        if(wet&&smt){
            if(we[0]>=wt[1]&&sm[0]>=st[0]||we[0]>=wt[0]&&sm[0]>=st[1]) return 1;
        }
        if(wet==t){
            if(wt[0]<=we[1]&&wt[1]<=we[0]||wt[1]<=we[1]&&wt[0]<=we[0]) return 1;
        }
        if(smt==t){
            if(st[0]<=sm[1]&&st[1]<=sm[0]||st[1]<=sm[1]&&st[0]<=sm[0]) return 1;
        }
        return 2;

    }
}

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:18:28: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   18 |             if(we[0]>=wt[1]&&sm[0]>=st[0]||we[0]>=wt[0]&&sm[0]>=st[1]) return 1;
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~
robots.cpp:21:28: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   21 |             if(wt[0]<=we[1]&&wt[1]<=we[0]||wt[1]<=we[1]&&wt[0]<=we[0]) return 1;
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~
robots.cpp:24:28: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   24 |             if(st[0]<=sm[1]&&st[1]<=sm[0]||st[1]<=sm[1]&&st[0]<=sm[0]) return 1;
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~
robots.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
#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...