Submission #56502

# Submission time Handle Problem Language Result Execution time Memory
56502 2018-07-11T13:55:34 Z hamzqq9 Wombats (IOI13_wombats) C++14
0 / 100
2259 ms 263168 KB
#include "wombats.h"
#include<bits/stdc++.h>
#define lf double
#define ll long long
#define ull unsigned ll
#define ii pair<int,int>
#define li pair<ll,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define iiii2 pair<int,iii>
#define lii pair<ll,ii>
#define lolo pair<ll,ll>
#define heap priority_queue
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(),x.end()
#define len(x) strlen(x)
#define sz(x) (int) x.size()
#define orta ((bas+son)/2)
#define min3(x,y,z) min(min(x,y),z)
#define max3(x,y,z) max(max(x,y),z)
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define MOD 1000000007
#define inf 2000000001
#define N 1000000005
#define LOG 20
#define magic 100
#define MAX 1000005
#define KOK 350
#define EPS 0.000000000001
#define pw(x) (1<<(x))
#define PI 3.1415926535
using namespace std;


struct SEG {

	int res[100][100];

} S[5000*2+1000];

bool flag=false;
int H[5000][100],V[5000][100];
int R,C;

SEG merge(SEG A,SEG B) {

	SEG RES;

	for(int i=0;i<C;i++) {

		for(int j=0;j<C;j++) {

			RES.res[i][j]=inf;

			for(int k=0;k<C;k++) {

				umin(RES.res[i][j],A.res[i][k]+B.res[k][j]);

			}

		}

	}

	return RES;

}

int pre[2][100];

SEG create2(int bas) {

	SEG RES;

	pre[0][0]=pre[1][0]=0;

	for(int i=1;i<C;i++) {

		pre[0][i]=pre[0][i-1]+H[bas][i-1];

		pre[1][i]=pre[1][i-1]+H[bas+1][i-1];

	}

	for(int i=0;i<C;i++) {

		for(int j=0;j<C;j++) {

			RES.res[i][j]=inf;

			for(int k=0;k<C;k++) {

				umin(RES.res[i][j],V[bas][k]+abs(pre[0][k]-pre[0][i])+abs(pre[1][k]-pre[1][j]));

			}

			//printf("%d %d %d %d\n",bas,i,j,RES.res[i][j]);

		}

	}

	return RES;

}

void up(int node,int bas,int son,int x,int y) {

	if(bas>y || son<x) return ;

	if(son-bas==1) {

		S[node]=create2(bas);

		return ;

	}

	up(node*2,bas,orta,x,y);
	up(node*2+1,orta,son,x,y);

	S[node]=merge(S[node*2],S[node*2+1]);

}

void build(int node,int bas,int son) {

	if(bas+1==son) {

		S[node]=create2(bas);

		return ;

	}

	build(node*2,bas,orta);
	build(node*2+1,orta,son);

	S[node]=merge(S[node*2],S[node*2+1]);

}

void init(int R, int C, int H[5000][200], int V[5000][200]) {

	::R=R;
	::C=C;

	for(int i=0;i<R;i++) {

		for(int j=0;j<C;j++) {

			::H[i][j]=H[i][j];
			::V[i][j]=V[i][j];

		}

	}
	
	if(C>200) {

		flag=1;

		return ;

	}

	build(1,0,R-1);

}

void changeH(int P, int Q, int W) {
    
	H[P][Q]=W;

	if(flag) return ;

	up(1,0,R-1,P-1,P+1);

}

void changeV(int P, int Q, int W) {
    
	V[P][Q]=W;

	if(flag) return ;

	up(1,0,R-1,P,P+1);

}

int shp(int x,int y) {



}

int escape(int V1, int V2) {

	if(flag) return shp(V1,V2);

	return S[1].res[V1][V2];

}
/*
int h[5000][200],v[5000][200];

int main() {

	freopen("sample.in","r",stdin);

	int r,c;

	scanf("%d %d",&r,&c);

	for(int i=0;i<r;i++) {

		for(int j=0;j<c-1;j++) {

			scanf("%d",&h[i][j]);

		}

	}

	for(int i=0;i<r-1;i++) {

		for(int j=0;j<c;j++) {

			scanf("%d",&v[i][j]);

		}

	}

	init(r,c,h,v);

	int q;

	scanf("%d",&q);

	while(q--) {

		int t,x,y,z;

		scanf("%d",&t);

		if(t==1) {

			scanf("%d %d %d",&x,&y,&z);

			changeH(x,y,z);

		}
		else if(t==2){

			scanf("%d %d %d",&x,&y,&z);

			changeV(x,y,z);

		}
		else {

			scanf("%d %d",&x,&y);

			printf("%d\n",escape(x,y));

		}

	}

}*/

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 'int shp(int, int)':
wombats.cpp:204:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Runtime error 1326 ms 263168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 263168 KB Memory limit exceeded 263168 {'time-wall': '0.056', 'max-rss': '1692', 'csw-forced': '2', 'cg-mem': '263168', 'time': '0.003', 'csw-voluntary': '3'} 262144
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2259 ms 263168 KB Memory limit exceeded 263168 {'time-wall': '2.347', 'max-rss': '10472', 'csw-forced': '236', 'cg-mem': '263168', 'time': '2.259', 'csw-voluntary': '3'} 262144
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1784 ms 263168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2074 ms 263168 KB Memory limit exceeded 263168 {'time-wall': '2.148', 'max-rss': '10472', 'csw-forced': '183', 'cg-mem': '263168', 'time': '2.074', 'csw-voluntary': '3'} 262144
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2215 ms 263168 KB Memory limit exceeded 263168 {'time-wall': '2.307', 'max-rss': '10476', 'csw-forced': '159', 'cg-mem': '263168', 'time': '2.215', 'csw-voluntary': '3'} 262144
2 Halted 0 ms 0 KB -