Submission #111077

#TimeUsernameProblemLanguageResultExecution timeMemory
111077The_WolfpackRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include "robots.h"
#include <bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
using namespace std;

int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[])
{
    vector<pii> v;
    for(int i=0;i<T;i++) v.push_back({W[i],S[i]});
    sort(X,X+A);
    sort(Y,Y+B);
    sort(v.begin(),v.end());
    auto ok=[&](int mid)
    {
        priority_queue<pii> PQ;
        vector<int> resen(T);
        int j=0;
        for(int i=0;i<A;i++)
        {
            int vreme=0;
            while(j<T && X[i]>v[j].x)
            {
                j++;
                PQ.push({v[j].y,j});
            }
            while(!PQ.empty() && vreme<mid)
            {
                ++vreme;
                resen[PQ.top().y]=1;
                PQ.pop();
            }
        }
        while(j<T)
        {
            j++;
            PQ.push({v[j].y,j});
        }
        for(int i=B-1;i>=0;i--)
        {
            int vreme=0;
            while(!PQ.empty() && vreme<mid && PQ.top().x<Y[i])
            {
                vreme++; 
                resen[PQ.top().y]=1;
                PQ.pop(); 
            }
        }
        for(int i=0;i<T;i++) if(!resen[i]) return 0;
        return 1;
    }
    int l=0;
    int r=T;
    int odg=-1;
    while(l<=r)
    {
        int mid=(l+r)/2;
        if(ok(mid))
        {
            odg=mid;
            l=mid+1;
        }
        else r=mid-1;
    }
    return odg;
}

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:53:5: error: expected ',' or ';' before 'int'
     int l=0;
     ^~~
robots.cpp:56:11: error: 'l' was not declared in this scope
     while(l<=r)
           ^