Submission #470068

#TimeUsernameProblemLanguageResultExecution timeMemory
470068Carmel_Ab1Robots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>vl;
#define all(x) x.begin(),x.end()
#define pb push_back


int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    int bya=0,byb=0,both=0;

    for(int i=0; i<T; i++){
        bool oka=0,okb=0;
        for(int j=0; j<A; j++)
            if(W[i]<X[j])
                oka=1;
        for(int j=0; j<B; j++)
            if(S[i]<Y[j])
                okb=1;
        if(oka && okb)
            both++;
        else if(oka)
            bya++;
        else if(okb)
            byb++;
        else return -1;
    }
    int ans=0;
    ans+=bya/A + byb/B;
    bya%=A,byb%=B;
    if(!both)return ans+(bya!=0)+(byb!=0);

    return ans;
}

int main(){
    int A,B,T;
    cin >> A >> B >> T;
    int X[A];
    for(int i=0; i<A; i++)
        cin >> X[i];
    int Y[B];
    for(int i=0; i<B; i++)
        cin >> Y[i];
    int W[T],S[T];
    for(int i=0; i<T; i++)
        cin >> W[i] >> S[i];
    cout << putaway(A,B,T,X,Y,W,S);
    return 0;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccPbKtJr.o: in function `main':
robots.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccXUzhSr.o:grader.c:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status