이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wombats.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn=5000+10,maxm=200+10,t=200,mt=(maxn/t)+5;
int n,m,inf=1e9+5;
struct bakhsh{
int allr[t+5][maxm],allc[t+5][maxm],dp[maxm][maxm],ps[maxm],suf[maxm];
void calps(int i){
for(int j=1;j<=m;j++){
ps[j]=ps[j-1]+allr[i][j-1];
}
}
void calc(){
for(int k=1;k<=m;k++){
calps(0);
for(int j=1;j<=m;j++){
dp[k][j]=abs(ps[k]-ps[j]);
}
for(int i=1;i<t;i++){
int mn=inf;
for(int j=1;j<=m;j++){
mn=min(mn+allr[i][j-1],dp[k][j]+allc[i-1][j]);
ps[j]=mn;
}
mn=inf;
for(int j=m;j>=1;j--){
mn=min(mn+allr[i][j],dp[k][j]+allc[i-1][j]);
dp[k][j]=min(ps[j],mn);
}
}
for(int j=1;j<=m;j++){
dp[k][j]+=allc[t-1][j];
}
}
}
void updr(int i,int j,int w){
allr[i][j]=w;
}
void updc(int i,int j,int w){
allc[i][j]=w;
}
}allsq[mt];
void init( int R, int C, int H[5000][200], int V[5000][200]) {
n=R;
m=C;
for(unsigned int i=0;i<n;i++){
for(unsigned int j=0;j<m-1;j++){
allsq[i/t].updr(i%t,j,H[i][j]);
}
}
for(unsigned int i=0;i<n-1;i++){
for(unsigned int j=0;j<m;j++){
allsq[i/t].updc(i%t,j,V[i][j]);
}
}
for(int i=0;i<mt;i++){
allsq[i].calc();
}
}
void changeH( int P, int Q, int W) {
allsq[P/t].updr(P%t,Q,W);
allsq[P/t].calc();
}
void changeV( int P, int Q, int W) {
allsq[P/t].updc(P%t,Q,W);
allsq[P/t].calc();
}
int escape( int V1, int V2) {
return allsq[0].dp[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: In function 'void init(int, int, int (*)[200], int (*)[200])':
wombats.cpp:47:27: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
47 | for(unsigned int i=0;i<n;i++){
| ~^~
wombats.cpp:48:31: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
48 | for(unsigned int j=0;j<m-1;j++){
| ~^~~~
wombats.cpp:52:27: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
52 | for(unsigned int i=0;i<n-1;i++){
| ~^~~~
wombats.cpp:53:31: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare]
53 | for(unsigned int j=0;j<m;j++){
| ~^~
# | 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... |