| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1101315 | Sunbae | Copy and Paste 3 (JOI22_copypaste3) | C++17 | 2284 ms | 223272 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define z exit(0)
typedef long long ll;
using namespace std;
const int N = 2555;
const ll inf = 1e18;
char s[N];
ll dp[10001][10001];
int A, B, C, n, vis[10001][10001];
signed main(){
scanf("%d %s %d %d %d", &n, s, &A, &B, &C);
for(int i = 0; i<=n; ++i) fill(dp[i], dp[i]+10001, inf);
using T = tuple<ll,int,int>;
priority_queue<T, vector<T>, greater<T>> pq;
pq.emplace(dp[0][0] = 0, 0, 0);
while(!pq.empty()){
ll dis; int i, j; tie(dis, i, j) = pq.top(); pq.pop();
if(vis[i][j]) continue; vis[i][j] = 1;
if(dp[i][j] >= inf) continue;
if(i+1 <= 1e4 && dp[i+1][j] > dp[i][j] + A) pq.emplace(dp[i+1][j] = dp[i][j] + A, i+1, j);
if(i+j <= 1e4 && dp[0][i+j] > dp[i][j] + B) pq.emplace(dp[0][i+j] = dp[i][j] + B, 0, i+j);
if(i+j <= 1e4 && dp[i+j][j] > dp[i][j] + C) pq.emplace(dp[i+j][j] = dp[i][j] + C, i+j, j);
}
printf("%lld", *min_element(dp[n], dp[n]+10001));
}컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
