# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955235 | 2024-03-29T22:13:45 Z | Dennis_Jason | JJOOII 2 (JOI20_ho_t2) | C++14 | 1 ms | 348 KB |
#include <bits/stdc++.h> #define NMAX 200001 #define pb push_back #define MOD 1000000007 #define nl '\n' #define INF 0x3f3f3f3f #define int long long using namespace std; ifstream fin("aib.in"); ofstream fout("aib.out"); int n,k; string s; /// op1:delete s[0] /// op2:delete s[s.size()-1] /// op3:delete between (0,s.size()-1) signed main() { cin>>n>>k; cin>>s; int cnt=0; int cntJ=0,cntO=0,cntI=0; for(int i=0;i<s.size();++i) { ///verificam daca putem folosi J gasit sau nu if(s[i]=='J' && cntJ<k) { cntJ++; } else if(s[i]=='J'&& cntJ>=1 && cntI==0) { cnt++; } ///verificam daca putem folosi O gasit sau nu if(s[i]=='O' && cntJ>=k && cntO<k) { cntO++; } else if(s[i]=='O' && cntJ>=1 && cntI==0) { cnt++; } //verificam daca putem folosi I gasit if(s[i]=='I' && cntI<k && cntO>=k) { cntI++; } else if(s[i]=='I' && cntJ>=1 && cntI<k) { cnt++; } } cout<<cnt; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |