답안 #383574

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
383574 2021-03-30T10:06:16 Z Keshi 웜뱃 (IOI13_wombats) C++17
55 / 100
20000 ms 17332 KB
//In the name of God
#include <bits/stdc++.h>
#include "wombats.h"
using namespace std;

typedef int ll;
typedef pair<ll, ll> pll;

const ll maxn = 5010;
const ll maxm = 210;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()

ll r, c;
ll h[maxn][maxm], v[maxn][maxm];
ll dis[maxm][maxm], dl[maxm], dr[maxm];

void solve(){
	for(ll i = 0; i < c; i++){
		fill(dis[i], dis[i] + c, inf);
		dis[i][i] = 0;
		for(ll o = 0; o < r; o++){
			for(ll j = 0; j < c; j++){
				dl[j] = dis[i][j];
				if(j) dl[j] = min(dl[j], dl[j - 1] + h[o][j - 1]);
			}
			for(ll j = c; j--;){
				dr[j] = dis[i][j];
				if(j + 1 < c) dr[j] = min(dr[j], dr[j + 1] + h[o][j]);
			}
			for(ll j = 0; j < c; j++){
				dis[i][j] = min(dl[j], dr[j]) + v[o][j];
			}
		}
	}
}


void init(int R, int C, int H[5000][200], int V[5000][200]) {
    r = R;
	c = C;
	for(ll i = 0; i < r; i++){
		for(ll j = 0; j < c - 1; j++){
			h[i][j] = H[i][j];
		}
	}
	for(ll i = 0; i < r - 1; i++){
		for(ll j = 0; j < c; j++){
			v[i][j] = V[i][j];
		}
	}
	solve();
}

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

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

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

/*int main(){
    fast_io;

	cin >> r >> c;
	for(ll i = 0; i < r; i++){
		for(ll j = 0; j < c - 1; j++){
			cin >> h[i][j];
		}
	}
	for(ll i = 0; i < r - 1; i++){
		for(ll j = 0; j < c; j++){
			cin >> v[i][j];
		}
	}
	solve();
	cout << escape(2, 1) << "\n";
	cout << escape(3, 3) << "\n";
	changeV(0,0,5);
	changeH(1,1,6);
	cout << escape(2, 1) << "\n";



    return 0;
}*/

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;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 8300 KB Output is correct
2 Correct 25 ms 8300 KB Output is correct
3 Correct 102 ms 9964 KB Output is correct
4 Correct 25 ms 8300 KB Output is correct
5 Correct 24 ms 8300 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 79 ms 1388 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 932 ms 748 KB Output is correct
2 Correct 898 ms 876 KB Output is correct
3 Correct 928 ms 876 KB Output is correct
4 Correct 922 ms 876 KB Output is correct
5 Correct 925 ms 812 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 4564 ms 876 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 16364 KB Output is correct
2 Correct 77 ms 16364 KB Output is correct
3 Correct 70 ms 16364 KB Output is correct
4 Correct 115 ms 17332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 931 ms 812 KB Output is correct
2 Correct 894 ms 812 KB Output is correct
3 Correct 920 ms 748 KB Output is correct
4 Correct 932 ms 812 KB Output is correct
5 Correct 912 ms 748 KB Output is correct
6 Correct 72 ms 16364 KB Output is correct
7 Correct 74 ms 16436 KB Output is correct
8 Correct 80 ms 16364 KB Output is correct
9 Correct 114 ms 17132 KB Output is correct
10 Correct 24 ms 8300 KB Output is correct
11 Correct 25 ms 8300 KB Output is correct
12 Correct 106 ms 10092 KB Output is correct
13 Correct 24 ms 8300 KB Output is correct
14 Correct 24 ms 8300 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 2 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 81 ms 1388 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 4570 ms 812 KB Output is correct
28 Execution timed out 20070 ms 16680 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 911 ms 880 KB Output is correct
2 Correct 898 ms 748 KB Output is correct
3 Correct 932 ms 812 KB Output is correct
4 Correct 920 ms 964 KB Output is correct
5 Correct 901 ms 812 KB Output is correct
6 Correct 76 ms 16364 KB Output is correct
7 Correct 75 ms 16364 KB Output is correct
8 Correct 72 ms 16440 KB Output is correct
9 Correct 113 ms 17132 KB Output is correct
10 Correct 24 ms 8300 KB Output is correct
11 Correct 24 ms 8300 KB Output is correct
12 Correct 105 ms 9964 KB Output is correct
13 Correct 24 ms 8428 KB Output is correct
14 Correct 25 ms 8300 KB Output is correct
15 Correct 9430 ms 16572 KB Output is correct
16 Execution timed out 20097 ms 16620 KB Time limit exceeded
17 Halted 0 ms 0 KB -