Submission #1253039

#TimeUsernameProblemLanguageResultExecution timeMemory
1253039FernandoJC07장애물 (IOI25_obstacles)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define For(i, a, n) for(int i = a; i<n; ++i) #define vi vector<int> #define vii vector<vector<int>> using namespace std; const int INF = 1e9+7; vi res; void initialize(vi T, vi H){ int n = T.size(); int m = H.size(); vi mt(n); mt[0] = T[0]; For(i, 1, n) mt[i] = max(mt[i-1], T[i]); vi mint(n); mint[0] = T[0]; For(i, 1, n) mint[i] = min(mint[i-1], T[i]); int minx = INF; For(i, 0, m){ minx = min(minx, H[i]); int upper = upper_bound(mt.begin(), mt.end(), H[i]) - mt.begin(); --upper; if(upper==-1) continue; if(upper == n-1){ minx = INF; res.push_back(i); continue; } int l = 0, r = m-1; while(r>l){ int mid = l + (r-l)/2; if(mint[mid]<=minx) r = mid; else l = mid+1; } if(upper>=l) res.pb(i); } mos(res); } bool can_reach(int L, int R, int S, int D){ if(S>D) swap(S, D); auto i1 = lower_bound(res.begin(), res.end(), S); auto i2 = upper_bound(res.begin(), res.end(), D); return (i1 == i2); }

Compilation message (stderr)

obstacles.cpp: In function 'void initialize(std::vector<int>, std::vector<int>)':
obstacles.cpp:34:26: error: 'class std::vector<int>' has no member named 'pb'
   34 |         if(upper>=l) res.pb(i);
      |                          ^~
obstacles.cpp:36:5: error: 'mos' was not declared in this scope; did you mean 'cos'?
   36 |     mos(res);
      |     ^~~
      |     cos