Submission #258314

#TimeUsernameProblemLanguageResultExecution timeMemory
258314eohomegrownappsRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll w,h; ll grid[50000][50000]; bool success(ll mid){ vector<vector<ll>> dp(2,vector<ll>(w+1,0)); for (ll i = w-1; i>=0; i--){ dp[0][i]=mid*(w-1-i); } bool c = 1; for (ll y = h-1; y>=0; y--){ dp[c][w]=mid*(h-1-y); for (ll x = w-1; x>=0; x--){ dp[c][x]=dp[c][x+1]+dp[!c][x]-dp[!c][x+1]-grid[x][y]; if (dp[c][x]<0){ return false; } } c=!c; } return true; } int putaway(int lx, int ly, int n, int xpos[], int ypos[], int xtoys[], int ytoys[]) { sort(xpos,xpos+lx); sort(ypos,ypos+ly); for (ll i = 0; i<n; i++){ xtoys[i]=upper_bound(xpos,xpos+lx,xtoys[i])-xpos; ytoys[i]=upper_bound(ypos,ypos+ly,ytoys[i])-ypos; } w=lx+1; h=ly+1; grid.resize(w,vector<ll>(h,0)); for (ll i = 0; i<n; i++){ grid[xtoys[i]][ytoys[i]]++; } if (grid[w-1][h-1]>0){ return -1; } ll l = 0, r = n; while (l<=r){ ll mid = (l+r)/2;; if (success(mid)){ r=mid-1; } else { l=mid+1; } } return l; }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:38:7: error: request for member 'resize' in 'grid', which is of non-class type 'll [50000][50000] {aka long long int [50000][50000]}'
  grid.resize(w,vector<ll>(h,0));
       ^~~~~~