Submission #963548

# Submission time Handle Problem Language Result Execution time Memory
963548 2024-04-15T09:51:09 Z irmuun Robots (IOI13_robots) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int putaway(int A,int B,int T,int X[],int Y[],int W[],int S[]){
    if(T==2&&A+B==2){
        int w[A+B],s[A+B];
        for(int i=0;i<A;i++){
            w[i]=x[i];
            s[i]=2e9;
        }
        for(int i=A;i<A+B;i++){
            w[i]=2e9;
            s[i]=y[i];
        }
        function <bool(int,int)> check=[&](int i,int j){
            if(w[i]>=W[i]&&s[i]>=S[j]) return true;
            return false;
        }
        if(check(0,1)&&check(1,0)) return 1;
        if(check(0,0)&&check(1,1)) return 1;
        if(check(0,1)&&check(0,0)) return 2;
        if(check(0,1)&&check(1,1)) return 2;
        return -1;
    }
    return -1;
}

Compilation message

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:16:18: error: 'x' was not declared in this scope
   16 |             w[i]=x[i];
      |                  ^
robots.cpp:21:18: error: 'y' was not declared in this scope
   21 |             s[i]=y[i];
      |                  ^
robots.cpp:27:9: error: expected ',' or ';' before 'if'
   27 |         if(check(0,1)&&check(1,0)) return 1;
      |         ^~