답안 #499432

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499432 2021-12-28T12:03:48 Z Alisaf9 Kamenčići (COCI21_kamencici) C++14
0 / 70
1 ms 204 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k,f1=0,f2=0,s1=0,s2=0;
    cin>>n>>k;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(i%2==0)
        {
            if(s[i]=='C')
                f1++;
        }
        else
        {
            if(s[i]=='C')
                s1++;
        }
            if(f1==k||s1==k)
            {
                break;
            }
    }
    int y=(s.size()-1)%2;
    for(int i=s.size()-1;i>=0;i--)
    {
        if(i%2==y)
        {
            if(s[i]=='C')
                f2++;
        }
        else
        {
            if(s[i]=='C')
                s2++;
        }
            if(f2==k||s2==k)
            {
                break;
            }
    }
    if(f1<s1||f2<s2)
    {
        cout<<"DA";
    }
    else if(f1>s1&&f2>s2)
        cout<<"NE";
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:11:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i=0;i<s.size();i++)
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct