Submission #494217

#TimeUsernameProblemLanguageResultExecution timeMemory
494217asandikciKamenčići (COCI21_kamencici)C++17
0 / 70
1 ms204 KiB
#include"iostream" // #include"vector" // #include"queue" // #include"deque" // #include"set" // #include"map" // #include"algorithm" // #include"cstring" // #define int long long using namespace std; void solve(){ int n,k; cin >> n >> k; string str; cin >> str; int turn = 1; // 1->Antun(DA) | 2-> Branka(NE) int red0=0,red1=0; for(int i=0;i<n;i++){ if(turn==1){ if(str[0]=='P'){ str = str.substr(1,str.length()-1); } else if(str[str.length()-1]=='P'){ str = str.substr(0,str.length()-1); } else{ str = str.substr(1,str.length()-1); red1++; } if(red1==k){ cout << "NE\n";return; } turn=0; } else{ if(str[0]=='P'){ str = str.substr(1,str.length()-1); } else if(str[str.length()-1]=='P'){ str = str.substr(0,str.length()-1); } else{ str = str.substr(1,str.length()-1); red0++; } if(red0==k){ cout << "DA\n";return; } turn=1; } // cout << str << "\n"; } } signed main(){ ios::sync_with_stdio(false); cin.tie(0); // freopen("","r",stdin);freopen("","w",stdout); int t=1; // cin >>t; for(int i=1;i<=t;i++){ // cout << "Case " << i << ":\n"; solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...