Submission #310022

#TimeUsernameProblemLanguageResultExecution timeMemory
310022amunduzbaevRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include "robots.h"
#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
multiset< pair<int, int> >wt,st;
vector< pair<int,int> >r;
int solve(){

    int ans=0;
    while(wt.size()>0&&st.size()>0){
        ans++;
        for(int i=0;i<r.size();i++){
            if(!wt.size()&&!st.size()) break;
            pair<int,int> x=r[i];
            int robot=x.first;
            int type=x.second;

            //cout<<robot<<"\n";

            if(type == 0)
            {
                auto toy =  wt.upper_bound({robot,0});
                if(toy == wt.begin()) continue;
                toy--;
                int wtoy = (*toy).first;
                int stoy = (*toy).second;

                wt.erase( wt.find( {wtoy,stoy} ) );
                st.erase( st.find( {stoy,wtoy} ) );

            }
            else
            {
                auto toy=st.upper_bound({robot,0});
                if(toy == st.begin()) continue;
                toy--;
                int wtoy = (*toy).first;
                int stoy = (*toy).second;

				st.erase(st.find({stoy, wtoy}));
				wt.erase(wt.find({wtoy, stoy}));
				//cout<<"works\n";
            }
            //cout<<wt.size()<<"\n";
        }

    }

    return ans;
}
int putaway(int a, int b, int t, int a1[], int b1[], int w[], int s[]) {
    sort(a1,a1+a);
    sort(b1,b1+b);
    int mxa=(a>0 ? a1[a-1]:0),mxb=(b>0 ? b1[b-1]:0);
    for(int i=0;i<t;i++){
        if(w[i]>=mxa&&s[i]>=mxb) return -1;

        wt.insert({w[i],s[i]});
        st.insert({s[i],w[i]});
    }
    for(int i=0;i<a;i++) r.push_back({a1[i],0});
    for(int i=0;i<b;i++) r.push_back({b1[i],1});
    sort(r.rbegin(),r.rend());
    int ans=solve();

    return ans;
}
/*
0 2 2
20 10
7 10
13 10

    */

Compilation message (stderr)

robots.cpp:2:10: fatal error: grader.cpp: No such file or directory
    2 | #include "grader.cpp"
      |          ^~~~~~~~~~~~
compilation terminated.