# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
288864 | luysasg | JJOOII 2 (JOI20_ho_t2) | C++17 | 2064 ms | 1420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main(){
vector <int> resp;
int n, k;
string s;
cin >> n >> k;
cin >> s;
for(int i=0;i<s.size();i++){
if(s[i]=='J'){
int cont=0, aux=-1, sai=0;
cont++;
for(int j=i+1;j<s.size();j++){
//cout << "inf: " << j << " " << s[j] << " " << cont << endl;
if(cont<k && s[j]=='J'){
//cout << "aq1" << endl;
cont++;
}
else if(cont>=k && cont<2*k && s[j]=='O'){
//cout << "aq2" << endl;
cont++;
}
else if(cont>=2*k && cont<3*k && s[j]=='I'){
//cout << "aq3" << endl;
cont++;
if(cont==3*k){
aux=1;
break;
}
}
else{
// cout << j << endl;
sai++;
}
}
if(aux==1){
resp.push_back(sai);
}
}
}
if(resp.size()==0){
cout << "-1" << endl;
}
else{
sort(resp.begin(), resp.end());
cout << resp[0] << endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |