Submission #220332

#TimeUsernameProblemLanguageResultExecution timeMemory
220332infinite_iq로봇 (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 400
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef short int si;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1e9+7;
const ll inf= 4e18;
const ld pai=acos(-1);
#include "robots.h"
int szw,szl,n;
priority_queue<int> pq;
int wl[100009],sl[100009];
pi r[1000009];
int check ( int x ) {
        int j = 0 ;
        pq.clear();
        for ( int i = 0 ;i < szw ;i ++ ) {
                while ( j < n && r[j].fi<wl[i] ) {
                        pq.push ( r[j].se ) ;
                        j ++ ;
                }
                for ( int num = 0 ; num < x ; num ++ ){
                        if ( ! pq.size() ) break ;
                        pq .pop ();
                }
        }
        for ( int i = j ; i < n ; i ++ ) {
                pb.push( r[j].se ) ;
        }
        for ( int i = szl-1 ; i >= 0 ;i -- ){
                for ( int num = 0 ; num < x ; num ++ ){
                        if ( !pq.size() ) return 1;
                        if ( pq.top () < sl[i] ) pq.pop() ;
                        else return 0 ;
                }
        }
        return !(s.size())
}
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
        szw=A , szl = B , n = T ;
        for ( int i =0 ;i < n ;i ++ ) {
                r[i]= { W[i] , S[i] } ;
        }
        for ( int i =0 ;i < szw ;i ++ ){
                wl[i] = X[i];
        }
        for ( int i =0 ;i < szl ;i ++ ){
                sl[i] = Y[i];
        }
        sort ( wl , wl+szw ) , sort ( sl , sl+szl ) , sort ( r , r+n ) ;
        int l = 0 , r = n +1 ;
        while ( r - l > 1 ) {
                if ( check ( mid ) ) r = mid;
                else l = mid;
        }
        if ( r == n+1 ) return -1 ;
        return r ;
}

Compilation message (stderr)

robots.cpp: In function 'int check(int)':
robots.cpp:36:12: error: 'class std::priority_queue<int>' has no member named 'clear'
         pq.clear();
            ^~~~~
robots.cpp:6:12: error: 'push_back' was not declared in this scope
 #define pb push_back
            ^
robots.cpp:48:17: note: in expansion of macro 'pb'
                 pb.push( r[j].se ) ;
                 ^~
robots.cpp:57:18: error: 's' was not declared in this scope
         return !(s.size())
                  ^
robots.cpp:58:1: error: expected ';' before '}' token
 }
 ^