# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717580 | vjudge1 | JJOOII 2 (JOI20_ho_t2) | C++11 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
vector<char> v;
int main(){
int l,k,templ,cnt=0;
cin >> l >> k;
for(int i=0;i<l;i++){
char c;
cin >> c;
v.push_back(c);
}
templ=l;
int p=0;
while(v[p]!='J'){
p++;
templ--;
}
v.erase(v.begin()+p-1);
int q=l-1;
while(v[q]!='I'){
q--;
templ--;
}
if(q!=l-1){
v.erase(v.begin()+q+1,v.end());
}
//cout << templ;
int cntj=0,cnto=0,cnti=0,cntother=0;
for(int i=0;i<templ;i++){
if(v[i]=='J'){
cntj++;
}
else if(v[i]=='O'){
cnto++;
}
else if(v[i]=='I'){
cnti++;
}
else{
cntother++;
}
}
int sum = cntj+cnto+cnti+cntother;
cout << sum - k*3;
}
Compilation message (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... |