제출 #866889

#제출 시각아이디문제언어결과실행 시간메모리
8668893as8Kamenčići (COCI21_kamencici)C++14
70 / 70
63 ms193336 KiB
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define fastIO cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); #define mid ((l + r) / 2) #define lChild ((index * 2) + 1) #define rChild ((index * 2) + 2) using namespace std; struct node { ll t, a, b; }; ll dp[351][351][200]; bool get(string& s, ll l, ll r, ll k, vector<ll>& score, bool round) { /* cout<<round + 1<< " => "<<l<<" "<<r<<endl; cout<<"Score: "<<score[0]<<" "<<score[1]<<endl;*/ if(score[0] == k) return false; else if(score[1] == k) return true; if(dp[l][r][score[0]] != -1) return dp[l][r][score[0]]; bool ans = round; score[round] += s[l] == 'C'; if(!round) ans |= get(s, l + 1, r, k, score, !round); else ans &= get(s, l + 1, r, k, score, !round); score[round] -= s[l] == 'C'; score[round] += s[r] == 'C'; if(!round) ans |= get(s, l, r - 1, k, score, !round); else ans &= get(s, l, r - 1, k, score, !round); score[round] -= s[r] == 'C'; return dp[l][r][score[0]] = ans; } void solve(ll _) { ll n, k; cin>>n>>k; memset(dp, -1, sizeof dp); string s; cin>>s; vector<ll> scores = {0, 0}; cout<<(get(s, 0, n - 1, k, scores, 0) ? "DA" : "NE")<<endl; } int main() { fastIO //freopen("file.in", "r", stdin); //freopen("file.out", "w", stdout); ll t = 0; solve(t); }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'bool get(std::string&, long long int, long long int, long long int, std::vector<long long int>&, bool)':
Main.cpp:41:31: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   41 |     return dp[l][r][score[0]] = ans;
      |            ~~~~~~~~~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...