# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
679235 | koolaider | Kamenčići (COCI21_kamencici) | C++17 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define pb push_back
#define ll long long
const int MN = 2e9;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("Ofast")
*/
//const long long ML = 1e18;
//const int MN = 1e9;
int main(int argc, char **argv){
//ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
//setIO("evolution");
int n, k; cin >> n >> k;
string s; cin >> s;
int Antun=0;
int Branca=0;
int A=0, B=0;
for(int i = 0; i<n; i++){
if(i%2==0){
if(s[i]=='C'){
Antun++;
}
}else{
if(s[i]=='C'){
Branca++;
}
}
if(Antun==k){
A++; break;
}else if(Branca==k){
B++; break;
}
}
int Antun2=0;
int Branca2=0;
int counter=0;
for(int i = n-1; i>=0; i--){
if(counter%2==0){
if(s[i]=='C'){
Antun2++;
}
}else{
if(s[i]=='C'){
Branca2++;
}
}
counter++;
if(Antun2==k){
A++; break;
}else if(Branca2==k){
B++; break;
}
}
if(A>B){
cout << "NE";
}else{
cout << "DA";
}
return 0;
}
//g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -O2 -Wno-unused-result
//g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG
Compilation message (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... |