Submission #358359

# Submission time Handle Problem Language Result Execution time Memory
358359 2021-01-25T11:31:52 Z tengiz05 Wombats (IOI13_wombats) C++17
0 / 100
1138 ms 16348 KB
#include "wombats.h"
#ifndef EVAL
#include "grader.c"
#endif
#include <bits/stdc++.h>
using namespace std;
int n, m;
int h[5000][200], v[5000][200];
int dp[200][200];
int old[200][200];
void recalc(){
	memset(dp,0x3f3f3f3f,sizeof dp);
	memset(old,0x3f3f3f3f,sizeof old);
	for(int start = 0; start < m; start++){
		int carry = 0;
		for(int i=start;i<m;i++){
			old[start][i] = carry;
			carry += h[0][i];
		}carry = 0;
		for(int i=start-1;i>=0;i--){
			carry += h[0][i];
			old[start][i] = carry;
		}
		for(int row=1;row<n;row++){
			for(int i=0;i<m;i++){
				dp[start][i] = old[start][i] + v[row-1][i];
			}
			swap(dp[start],old[start]);
		}swap(dp[start],old[start]);
	}
	//~ cout << "______________________________\n";
	//~ cout << "what my dp looks like\n";
	//~ for(int i=0;i<m;i++){
		//~ for(int j=0;j<m;j++){
			//~ cout << dp[i][j] << ' ';
		//~ }cout << '\n';
	//~ }cout << "______________________________\n\n";
}
void init(int R, int C, int H[5000][200], int V[5000][200]){
	n = R, m = C;
	for(int i=0;i<5000;i++){
		for(int j=0;j<200;j++){
			h[i][j] = H[i][j];
			v[i][j] = V[i][j];
		}
	}
	recalc();
}

void changeH(int P, int Q, int W){
	h[P][Q] = W;
	recalc();
	return;
}

void changeV(int P, int Q, int W){
	v[P][W] = W;
	recalc();
	return;
}

int escape(int V1, int V2){
	return dp[V1][V2];
}

Compilation message

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
1 Correct 568 ms 12440 KB Output is correct
2 Incorrect 563 ms 12524 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 8428 KB Output is correct
2 Correct 8 ms 8428 KB Output is correct
3 Correct 7 ms 8428 KB Output is correct
4 Incorrect 8 ms 8556 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 348 ms 8812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1138 ms 16348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 332 ms 8684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 339 ms 8696 KB Output isn't correct
2 Halted 0 ms 0 KB -