# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
655475 | Kamenčići (COCI21_kamencici) | C++17 | 1 ms | 324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<vector<int>> dp;
string s;
bool solve(int l, int r, int cnt1,int cnt2){
if (cnt1 >= k) return 0;
if (cnt2 >= k) return 1;
if (~dp[l][r]) return dp[l][r];
if (!solve(l+1,r,cnt2,cnt1+(s[l]=='C')) || !solve(l,r-1,cnt2,cnt1+(s[r]=='C'))) return dp[l][r] = 1;
return dp[l][r] = 0;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k >> s;
dp.resize(n,vector<int>(n,-1));
if (solve(0,n-1,0,0)) cout << "DA";
else 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... |