# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
567914 | 2022-05-24T10:48:17 Z | Baytoro | JJOOII 2 (JOI20_ho_t2) | C++17 | 13 ms | 3308 KB |
#include <bits/stdc++.h> using namespace std; #define Baytoro_Mayrambekov void solve() #define ios ios::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define int long long #define endl '\n' const int INF=1e18; void fopn(string name){ freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } int binpow(int a,int n){ if(n==0) return 1; if(n%2==1) return binpow(a, n-1)*a; else{ int b=binpow(a, n/2); return b*b; } } int k,n; vector<int> a,b,c; int get(int i, int j){ int l=lower_bound(all(a),i)-a.begin(); int u=lower_bound(all(c),j)-c.begin(); if(l<k || c.size()-u<k) return INF; int tmp=a[l-k]; int cmp=c[u+k-1]; return cmp-tmp+1-k*3; } int m,i,j,x,y,z,cnt=0,sum=0,res=0; Baytoro_Mayrambekov{ int J=0,O=0,I=0; string s; cin>>n>>k>>s; for(i=0;i<n;i++){ if(s[i]=='J') a.pb(i+1); else if(s[i]=='O') b.pb(i+1); else c.pb(i+1); } res=INF; for(i=0;i<b.size()-k+1;i++){ res=min(res,get(b[i],b[i+k-1])); } if(res==INF) res=-1; cout<<res<<endl; } main(){ ios; int T=1; //cin>>T; while(T--){ solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 320 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 316 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 320 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 320 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 316 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 320 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 316 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 328 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 320 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 324 KB | Output is correct |
34 | Correct | 1 ms | 324 KB | Output is correct |
35 | Correct | 1 ms | 316 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 320 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 316 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 320 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 316 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 328 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 320 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 324 KB | Output is correct |
34 | Correct | 1 ms | 324 KB | Output is correct |
35 | Correct | 1 ms | 316 KB | Output is correct |
36 | Correct | 9 ms | 2372 KB | Output is correct |
37 | Correct | 10 ms | 2892 KB | Output is correct |
38 | Correct | 11 ms | 2868 KB | Output is correct |
39 | Correct | 10 ms | 2968 KB | Output is correct |
40 | Correct | 10 ms | 3056 KB | Output is correct |
41 | Correct | 10 ms | 3016 KB | Output is correct |
42 | Correct | 13 ms | 2892 KB | Output is correct |
43 | Correct | 7 ms | 1832 KB | Output is correct |
44 | Correct | 6 ms | 2120 KB | Output is correct |
45 | Correct | 9 ms | 3088 KB | Output is correct |
46 | Correct | 9 ms | 2960 KB | Output is correct |
47 | Correct | 8 ms | 3040 KB | Output is correct |
48 | Correct | 9 ms | 2992 KB | Output is correct |
49 | Correct | 5 ms | 1868 KB | Output is correct |
50 | Correct | 8 ms | 2992 KB | Output is correct |
51 | Correct | 8 ms | 3020 KB | Output is correct |
52 | Correct | 5 ms | 2368 KB | Output is correct |
53 | Correct | 5 ms | 2856 KB | Output is correct |
54 | Correct | 5 ms | 3288 KB | Output is correct |
55 | Correct | 4 ms | 3308 KB | Output is correct |
56 | Correct | 3 ms | 3276 KB | Output is correct |