제출 #861736

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
8617362023-10-16 21:19:10Cyber_WolfKamenčići (COCI21_kamencici)C++17
70 / 70
109 ms501364 KiB
#include <bits/stdc++.h>
using namespace std;
#define lg long long
const lg N = 400;
lg dp[N][N][N], pref[N];
lg n, k;
string s;
lg solve(lg l, lg r, lg o)
{
if(o >= k) return 0;
if(pref[l-1]+pref[n]-pref[r]-o >= k) return 1;
auto&ret = dp[l][r][o];
if(~ret) return ret;
if((l-1+n-r)%2)
{
ret = min(solve(l+1, r, o), solve(l, r-1, o));
}
else{
ret = max(solve(l+1, r, o+(s[l-1] == 'C')), solve(l, r-1, o+(s[r-1] == 'C')));
}
// cout << l << ' ' << r << ' ' << o << '\n';
// cout << ret << '\n';
return ret;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...