이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wombats.h"
#include <cstdio>
#include <cstring>
#include <vector>
bool ckmax(auto& a, const auto& b) {return b>a?a=b,1:0;}
bool ckmin(auto& a, const auto& b) {return b<a?a=b,1:0;}
const int MC = 2e3+10;
int R, C, H[5000][200], V[5000][200], ans[MC][MC], dp[MC];
void compute_ans()
{
for(int i=0;i<C;++i)
{
memset(dp, 0x3f, C*sizeof*dp);
dp[i]=0;
//printf("Col %d\n", i);
for(int r=0;r<R;++r)
{
for(int c=0;c+1<C;++c)
ckmin(dp[c+1], dp[c]+H[r][c]);
for(int c=C-1;c>0;--c)
ckmin(dp[c-1], dp[c]+H[r][c-1]);
if(r+1<R)
for(int c=0;c<C;++c)
dp[c] += V[r][c];
//printf("HERE %d %d %d %d\n", dp[0], dp[1], dp[2], dp[3]);
}
memcpy(ans[i], dp, C*sizeof*dp);
}
}
void init(int R, int C, int H[5000][200], int V[5000][200])
{
::R=R;
::C=C;
memcpy(::H, H, sizeof ::H);
memcpy(::V, V, sizeof ::V);
compute_ans();
}
void changeH(int P, int Q, int W) { // 500x tot
H[P][Q]=W;
compute_ans();
}
void changeV(int P, int Q, int W) { // 500x tot
V[P][Q]=W;
compute_ans();
}
int escape(int V1, int V2) { // 200000x
return ans[V1][V2];
}
컴파일 시 표준 에러 (stderr) 메시지
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
15 | int res;
| ^~~
wombats.cpp:6:12: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
6 | bool ckmax(auto& a, const auto& b) {return b>a?a=b,1:0;}
| ^~~~
wombats.cpp:6:27: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
6 | bool ckmax(auto& a, const auto& b) {return b>a?a=b,1:0;}
| ^~~~
wombats.cpp:7:12: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
7 | bool ckmin(auto& a, const auto& b) {return b<a?a=b,1:0;}
| ^~~~
wombats.cpp:7:27: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
7 | bool ckmin(auto& a, const auto& b) {return b<a?a=b,1: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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |