| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 937248 | Andrey | Chorus (JOI23_chorus) | C++14 | 532 ms | 2528 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int dp[501][501];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,x,br = 0;
cin >> n >> x;
string s;
cin >> s;
vector<int> bruh(0);
for(int i = 0; i < 2*n; i++) {
if(s[i] == 'A') {
br++;
}
else {
bruh.push_back(br);
}
}
for(int i = 0; i <= n; i++) {
dp[0][i] = 0;
}
for(int i = 1; i <= n; i++) {
for(int k = 0; k <= n; k++) {
dp[i][k] = 1e9;
}
int sb = 0;
for(int j = i-1; j >= 0; j--) {
sb+=max(0,i-bruh[j]);
for(int k = 0; k < n; k++) {
dp[i][k+1] = min(dp[i][k+1],dp[j][k]+sb);
}
}
}
cout << dp[n][x];
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
