제출 #287211

#제출 시각아이디문제언어결과실행 시간메모리
287211TMJNWombats (IOI13_wombats)C++17
55 / 100
20060 ms26872 KiB
#include "wombats.h"
#include <bits/stdc++.h>
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...