# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
781517 | 2023-07-13T07:21:57 Z | vjudge1 | JJOOII 2 (JOI20_ho_t2) | C++17 | 0 ms | 212 KB |
#include<bits/stdc++.h> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL); #define endl "\n" #define ll long long #define pb push_back #define N int main(){ int n,k;cin>>n>>k; string str;cin>>str; int ans=1000000000; for(int i=0;i<n;i++){ int j=0,o=0,I=0; int cur=0; int son,ner,de; for(int jj=i;jj<n;jj++){ //cout<<i<<" "<<jj<<" "<<j<<" "<<o<<" "<<I<<" "<<cur<<" "<<str[jj]<<endl; if(str[jj]=='J'){ if(j==k)continue; if(j==0){ son=jj; j++; } else{ cur+=jj-son-1; son=jj; j++; } } if(str[jj]=='O'){ if(j!=k)continue; if(o==k)continue; if(o==0){ ner=jj; cur+=ner-son-1; o++; } else{ cur+=jj-ner-1; ner=jj; o++; } } if(str[jj]=='I'){ if(j!=k||o!=k)continue; if(I==0){ de=jj; cur+=de-ner-1;I++; } else{ cur+=jj-de-1; de=jj; I++; if(I==k){ ans=min(ans,cur);break; } } } } } if(ans==1000000000)ans=-1; cout<<ans<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |