# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
655482 | 2022-11-04T14:36:29 Z | Kamenčići (COCI21_kamencici) | C++17 | 45 ms | 84956 KB |
#include<bits/stdc++.h> using namespace std; int n,k; vector<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][cnt1]) return dp[l][r][cnt1]; if (!solve(l+1,r,cnt2,cnt1+(s[l]=='C')) || !solve(l,r-1,cnt2,cnt1+(s[r]=='C'))) return dp[l][r][cnt1] = 1; return dp[l][r][cnt1] = 0; } int main(){ cin.tie(0)->sync_with_stdio(0); cin >> n >> k >> s; dp.resize(n,vector<vector<int>>(n,vector<int>(k,-1))); if (solve(0,n-1,0,0)) cout << "DA"; else cout << "NE"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 316 KB | Output is correct |
9 | Correct | 1 ms | 448 KB | Output is correct |
10 | Correct | 1 ms | 316 KB | Output is correct |
11 | Correct | 1 ms | 448 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 316 KB | Output is correct |
9 | Correct | 1 ms | 448 KB | Output is correct |
10 | Correct | 1 ms | 316 KB | Output is correct |
11 | Correct | 1 ms | 448 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
13 | Correct | 12 ms | 18496 KB | Output is correct |
14 | Correct | 27 ms | 24148 KB | Output is correct |
15 | Correct | 11 ms | 13268 KB | Output is correct |
16 | Correct | 40 ms | 54092 KB | Output is correct |
17 | Correct | 45 ms | 84956 KB | Output is correct |
18 | Correct | 31 ms | 54100 KB | Output is correct |