Submission #290017

#TimeUsernameProblemLanguageResultExecution timeMemory
290017BadrangiikhRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; int n , m , k , l , r , mid , x , y , z , ans , cnt , s1 , s2 , s3 , s4 ; int weak [ 50005 ] ; int smol [ 50005 ] ; pair < int , int > toy [ 1000005 ] ; int w [ 1000005 ] ; int s [ 1000005 ] ; priority_queue < int > pq , pp ; vector < int > vc , vv ; bool check ( int s1 ) { pq = pp ; int s2 = 0 ; for ( int i = 0 ; i < m ; i ++ ) { while ( s2 < n && toy [ s2 ] . first < weak [ i ] ) { pq . push ( s [ toy [ s2 ] . second ] ) ; s2 ++ ; } s3 = s1 ; while ( s3 -- && pq . size ( ) > 0 ) pq . pop ( ) ; } for ( ; s2 < n ; s2 ++ ) { pq . push ( s [ toy [ s2 ] . second ] ) ; } vc = vv ; while ( pq . size ( ) > 0 ) { vc . push_back ( pq . top ( ) ) ; pq . pop ( ) ; } reverse ( vc . begin ( ) , vc . end ( ) ) ; s2 = 0 ; s3 = s1 ; for ( auto it : vc ){ while ( s2 < k && ( s3 == 0 || it >= smol [ s2 ] ) ){ s2 ++ ; s3 = k ; } if ( s2 == k ) return 0 ; s3 -- ; } return 1 ; } int putaway ( int A, int B, int T, int X[], int Y[], int W[], int S[]) { m = A ; k = B ; n = T ; weak = X ; sort ( weak , weak + m ) ; smol = Y ; sort ( smol , smol + k ) ; w = W ; s = S ; for ( int i = 0 ; i < n ; i ++ ) { if ( w [ i ] > weak [ m ] && s [ i ] > smol [ k ] ) { return -1; } toy [ i ] . first = w [ i ] ; toy [ i ] . second = i ; } sort ( toy , toy + n ) ; l = 1 ; r = n ; while ( l < r ) { mid = ( l + r ) / 2 ; if ( check ( mid ) == 1 ) r = mid ; else l = mid + 1 ; } return l ; }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:51:12: error: incompatible types in assignment of 'int*' to 'int [50005]'
   51 |     weak = X ;
      |            ^
robots.cpp:53:12: error: incompatible types in assignment of 'int*' to 'int [50005]'
   53 |     smol = Y ;
      |            ^
robots.cpp:55:9: error: incompatible types in assignment of 'int*' to 'int [1000005]'
   55 |     w = W ;
      |         ^
robots.cpp:56:9: error: incompatible types in assignment of 'int*' to 'int [1000005]'
   56 |     s = S ;
      |         ^