Submission #203224

#TimeUsernameProblemLanguageResultExecution timeMemory
203224staniewzkiJJOOII 2 (JOI20_ho_t2)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n, k; string str; cin >> n >> k >> str; vector<vector<int>> pos(3); vector<int> last(4, -1e9); map<char, int> id = {{'J', 0}, {'O', 1}, {'I', 2}}; int ans = 1e9; for(int i = 0; i < n; i++) { last[0] = i; int x = id[str[i]]; pos[x].emplace_back(last[x]); if(size(pos[x]) >= k) last[x + 1] = pos[x][size(pos[x]) - k]; ans = min(ans, i - last[3] + 1 - 3 * k); } if(ans > n) ans = -1; cout << ans << "\n"; }

Compilation message (stderr)

ho_t2.cpp: In function 'int main()':
ho_t2.cpp:18:6: error: 'size' was not declared in this scope
   if(size(pos[x]) >= k)
      ^~~~
ho_t2.cpp:18:6: note: suggested alternative: 'dysize'
   if(size(pos[x]) >= k)
      ^~~~
      dysize