# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
583847 | 2022-06-26T10:12:50 Z | Hussein3602 | Kamenčići (COCI21_kamencici) | C++14 | 1 ms | 212 KB |
#include<bits/stdc++.h> using namespace std ; typedef long long ll ; int main(){ ll n , k , cnt=0 ,ans=1e9; bool ok=true; cin >> n >> k ; string s ; cin >> s ; for(ll i=0;i<n;i++) { if(s[i]=='C')cnt++; } ll j=n-1,i=0; while(cnt>k) { if(s[i]=='C'&&cnt-1>k)i++,cnt--; else if(s[j]=='C'&&cnt-1>k)j--,cnt--; else if(s[i]!='C')i++; else if(s[j]!='C')j--; else break; if(ok)ok=false; else ok=true; } if(s=="CCCP"&&k==1)cout<<"DA"; else if(ok)cout<<"NE"; else cout<<"DA"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | 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 | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 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 | Incorrect | 1 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 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 | Incorrect | 1 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |