# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
869539 | JoksimKaktus | Kamenčići (COCI21_kamencici) | C++17 | 38 ms | 183124 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int dp [360][360][360];
int pre[360];
int n,k;
string s;
bool find(int l,int r,int m){
if(dp[l][r][m] != -1)return dp[l][r][m];
int h = pre[n] - m - (pre[r]-pre[l-1]);
if(m >= k){
return dp[l][r][m] = false;
}else if(h >= k){
return dp[l][r][m] = true;
}else{
return dp[l][r][m] = !find(l+1,r,h) || !find(l,r-1,h);
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
cin >> n >> k >> s;
pre[0]=0;
s = " " + s;
for(int i = 1;i <= n;i++){
pre[i]=pre[i-1] + (s[i] == 'C');
}
memset(dp,-1,sizeof dp);
bool da = find(1,n,0);
da ? cout << "DA" : cout << "NE";
return 0;
}
컴파일 시 표준 에러 (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... |