# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
583847 | Hussein3602 | Kamenčići (COCI21_kamencici) | C++14 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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";
}
컴파일 시 표준 에러 (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... |