Submission #717575

# Submission time Handle Problem Language Result Execution time Memory
717575 2023-04-02T08:28:58 Z vjudge1 JJOOII 2 (JOI20_ho_t2) C++11
0 / 100
1 ms 212 KB
#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());
    }
    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

ho_t2.cpp: In function 'int main()':
ho_t2.cpp:6:19: warning: unused variable 'cnt' [-Wunused-variable]
    6 |     int l,k,templ,cnt=0;
      |                   ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -