# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
681755 | Iliya | Kamenčići (COCI21_kamencici) | C++17 | 85 ms | 183004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Ye Rooz Khoob Miad ???
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
using namespace std;
typedef long long ll;
const int N = 350 + 10;
const int Inf = 1061109567;
int n, k, dp[N][N][N], ps[N];
bool solve(int l, int r, int m) {
if(dp[l][r][m] != -1)
return dp[l][r][m];
if(m >= k)
return dp[l][r][m] = 0;
int h = ps[n] - m - (ps[r] - ps[l - 1]);
if(h >= k)
return dp[l][r][m] = 1;
return dp[l][r][m] = !(solve(l + 1, r, h)) | !(solve(l, r - 1, h));
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
memset(dp, -1, sizeof dp);
cin >> n >> k;
string str;
cin >> str;
str = '!' + str;
for(int i = 1; i <= n; i++)
ps[i] = ps[i - 1] + (str[i] == 'C');
cout << (solve(1, n, 0) ? "DA" : "NE") << '\n';
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... |