제출 #203224

#제출 시각아이디문제언어결과실행 시간메모리
203224staniewzkiJJOOII 2 (JOI20_ho_t2)C++14
컴파일 에러
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";
}

컴파일 시 표준 에러 (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