답안 #164363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164363 2019-11-19T15:39:17 Z costle 웜뱃 (IOI13_wombats) C++17
컴파일 오류
0 ms 0 KB
#include <stdio.h>
#include <algorithm>
#define INF 1e9
#define ele (1<<9)
#define R 5000
#define C 200
#define BS 10
#define BN R/BS
using namespace std;
int H[R][C-1],V[R][C];
int sgt[ele<<1][C][C],p[C+1];
void update_(int xs,int xe,int w,int l,int r){
	if(l==r){
		for(int i=0;i<C;i++){
            for(int j=0;j<C;j++) sgt[w][i][j]=INF;
		}
		for(int i=0;i<C;i++){
			sgt[w][i][i]=0;
			for(int j=l*BS;j<(l+1)*BS;j++){
				for(int k=1;k<C;k++) sgt[w][i][k]=min(sgt[w][i][k-1]+H[j][k-1],sgt[w][i][k]);
				for(int k=C-1;k;k--) sgt[w][i][k-1]=min(sgt[w][i][k]+H[j][k-1],sgt[w][i][k-1]);
				for(int k=0;k<C;k++) sgt[w][i][k]+=V[j][k];
			}
		}
		return;
	}
	int m=(l+r)>>1;
	if(xs<=m) update_(xs,xe,w<<1,l,m);
	if(m<xe) update_(xs,xe,w<<1|1,m+1,r);
	for(int i=0;i<C;i++) p[i]=0;
	for(int i=0;i<C;i++){
		for(int j=C-1;j;j--){
			int mn=INF,mni=0;
			for(int k=p[j];k<=p[j+1];k++){
                if(mn>=sgt[w<<1][i][k]+sgt[w<<1|1][k][j]) mn=sgt[w<<1][i][k]+sgt[w<<1|1][k][j],mni=k;
			}
			sgt[w][i][j]=mn,p[j]=mni;
		}
	}
}
void init(int r, int c, int h[5000][200], int v[5000][200]) {
	memset(::h, 0x3f, sizeof(::h));
    for(int i=0;i<R;i++){
        for(int j=0;j<C-1;j++) H[i][j]=INF;
    }
    for(int i=0;i<r;i++){
        for(int j=0;j<c-1;j++) H[i][j]=h[i][j];
    }
    for(int i=0;i<r-1;i++){
        for(int j=0;j<c;j++) V[i][j]=v[i][j];
    }
	p[C]=C-1;
	update_(0,BN-1,1,0,BN-1);
}
 
void changeH(int a, int b, int c) {
	H[a][b]=c;
	upd(a/bs,a/bs,1,0,BN-1);
}
 
void changeV(int a, int b, int c) {
	V[a][b]=c;
	upd(a/bs,a/bs,1,0,BN-1);
}
 
int escape(int a, int b) {
	return st[1][a][b];
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
wombats.cpp: In function 'void init(int, int, int (*)[200], int (*)[200])':
wombats.cpp:42:11: error: '::h' has not been declared
  memset(::h, 0x3f, sizeof(::h));
           ^
wombats.cpp:42:29: error: '::h' has not been declared
  memset(::h, 0x3f, sizeof(::h));
                             ^
wombats.cpp:42:2: error: 'memset' was not declared in this scope
  memset(::h, 0x3f, sizeof(::h));
  ^~~~~~
wombats.cpp:42:2: note: suggested alternative: 'fd_set'
  memset(::h, 0x3f, sizeof(::h));
  ^~~~~~
  fd_set
wombats.cpp: In function 'void changeH(int, int, int)':
wombats.cpp:58:8: error: 'bs' was not declared in this scope
  upd(a/bs,a/bs,1,0,BN-1);
        ^~
wombats.cpp:58:8: note: suggested alternative: 'b'
  upd(a/bs,a/bs,1,0,BN-1);
        ^~
        b
wombats.cpp:58:2: error: 'upd' was not declared in this scope
  upd(a/bs,a/bs,1,0,BN-1);
  ^~~
wombats.cpp: In function 'void changeV(int, int, int)':
wombats.cpp:63:8: error: 'bs' was not declared in this scope
  upd(a/bs,a/bs,1,0,BN-1);
        ^~
wombats.cpp:63:8: note: suggested alternative: 'b'
  upd(a/bs,a/bs,1,0,BN-1);
        ^~
        b
wombats.cpp:63:2: error: 'upd' was not declared in this scope
  upd(a/bs,a/bs,1,0,BN-1);
  ^~~
wombats.cpp: In function 'int escape(int, int)':
wombats.cpp:67:9: error: 'st' was not declared in this scope
  return st[1][a][b];
         ^~
wombats.cpp:67:9: note: suggested alternative: 'sgt'
  return st[1][a][b];
         ^~
         sgt