이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wombats.h"
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int bucket_size=1000;
int H,W,K[200][200][5],A[5100][200],B[5100][200],L[200][200];
void update(int x){
int T[200];
for(int i=0;i<W;i++){
for(int j=0;j<W;j++){
T[j]=0xE869120;
}
T[i]=0;
for(int j=bucket_size*x;j<(bucket_size)*(x+1)&&j<H;j++){
for(int k=0;k<W-1;k++){
T[k+1]=min(T[k+1],T[k]+A[j][k]);
}
for(int k=W-2;k>=0;k--){
T[k]=min(T[k],T[k+1]+A[j][k]);
}
for(int k=0;k<W;k++){
T[k]+=B[j][k];
}
}
for(int j=0;j<W;j++){
K[i][j][x]=T[j];
}
}
}
void update_whole(){
for(int i=0;i<W;i++){
for(int j=0;j<W;j++){
L[i][j]=K[i][j][0];
}
}
for(int i=1;i*bucket_size<H;i++){
for(int j=0;j<W;j++){
int T[200];
for(int k=0;k<W;k++){
T[k]=0xE869120;
for(int l=0;l<W;l++){
T[k]=min(T[k],L[j][l]+K[l][k][i]);
}
}
for(int k=0;k<W;k++){
L[j][k]=T[k];
}
}
}
}
void init(int R, int C, int h[5000][200], int v[5000][200]) {
H=R;
W=C;
for(int i=0;i<H;i++){
for(int j=0;j<W-1;j++){
A[i][j]=h[i][j];
}
}
for(int i=0;i<H-1;i++){
for(int j=0;j<W;j++){
B[i][j]=v[i][j];
}
}
for(int i=0;i*bucket_size<H;i++){
update(i);
}
update_whole();
}
void changeH(int P, int Q, int W) {
A[P][Q]=W;
update(P/bucket_size);
update_whole();
}
void changeV(int P, int Q, int W) {
B[P][Q]=W;
update(P/bucket_size);
update_whole();
}
int escape(int V1, int V2) {
return L[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;
| ^~~
# | 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... |