Submission #499431

# Submission time Handle Problem Language Result Execution time Memory
499431 2021-12-28T11:59:53 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++;
        }
        if(i%2==1)
        {
            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++;
        }
        if(i%2!=y)
        {
            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++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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