Submission #783095

# Submission time Handle Problem Language Result Execution time Memory
783095 2023-07-14T15:23:23 Z tolbi Wombats (IOI13_wombats) C++17
55 / 100
303 ms 262144 KB
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor
#define author tolbi
#include<bits/stdc++.h>
using namespace std;
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr){return os<<pr.first<<" "<<pr.second;}
template<typename X> ostream& operator<<(ostream& os, vector<X> v){for (auto &it : v) os<<it; return os;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> v){for (auto &it : v) os<<it; return os;}
#define endl '\n'
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define vint(x) vector<int> x
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define rev(x) reverse(x.begin(), x.end())
#define tol(bi) (1LL<<((long long)(bi)))
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
typedef long long ll;
const ll INF = 1e15;
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "wombats.h"
const int MAXM = 100;
const int MAXN = 5000;
const int MAXSEG = 20000;
ll segtree[MAXSEG][MAXM][MAXM];
int n, m;
ll v[MAXN][MAXM],h[MAXN][MAXM];
int opt[MAXM][MAXM];
int segsize;
void merge(int node){
	if (node*2+1>=segsize){
		int pos = node-segsize/2;
		if (pos>=n){
			for (int i = 0; i < m; ++i)
			{
				for (int j = 0; j < m; j++){
					if (i==j) segtree[node][i][j]=0;
					else segtree[node][i][j]=INF;
				}
			}
			return;
		}
		for (int i = 0; i < m; i++){
			ll crr = 0;
			for (int j = i; j < m; j++){
				segtree[node][i][j]=crr+v[pos][j];
				if (j<m-1) crr+=h[pos][j];
			}
			crr=0;
			for (int j = i; j >= 0; j--){
				segtree[node][i][j]=crr+v[pos][j];
				if (j>0) crr+=h[pos][j-1];
			}
		}
		return;
	}
	int up = node*2+1;
	int down = node*2+2;
	for (int i = m-1; i >= 0; i--){
		for (int j = 0; j < m; j++){
			int lrang=0;
			if (j>0) lrang=max(lrang,opt[i][j-1]);
			int rrang=m-1;
			if (i<m-1) rrang=min(rrang,opt[i+1][j]);
			segtree[node][i][j]=segtree[up][i][lrang]+segtree[down][lrang][j];
			opt[i][j]=lrang;
			for (int k = lrang; k <= rrang; k++){
				if (segtree[up][i][k]+segtree[down][k][j]<segtree[node][i][j]){
					segtree[node][i][j]=segtree[up][i][k]+segtree[down][k][j];
					opt[i][j]=k;
				}
			}
		}
	}
}
void init(int R, int C, int H[5000][200], int V[5000][200]) {
	n=R,m=C;
	for (int i = 0; i < MAXN; i++){
		for (int j = 0; j < MAXM; j++){
			if (i<R-1 && j<C) v[i][j]=V[i][j];
			else v[i][j]=0ll;
			if (i<R && j<C-1) h[i][j]=H[i][j];
			else h[i][j]=0ll;
		}
	}
	segsize=tol(ceil(log2(n)+1))-1,0ll;
	for (int i = segsize-1; i >= 0; i--){
		merge(i);
	}
}
void changeH(int P, int Q, int W) {
	h[P][Q]=W;
	P+=segsize/2;
	merge(P);
	while (P>0){
		P=(P-1)/2;
		merge(P);
	}
}
void changeV(int P, int Q, int W) {
	v[P][Q]=W;
	P+=segsize/2;
	merge(P);
	while (P>0){
		P=(P-1)/2;
		merge(P);
	}
}
int escape(int V1, int V2) {
	return segtree[0][V1][V2];
	return 23;
}

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;
      |      ^~~
wombats.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
wombats.cpp: In function 'void init(int, int, int (*)[200], int (*)[200])':
wombats.cpp:95:36: warning: right operand of comma operator has no effect [-Wunused-value]
   95 |  segsize=tol(ceil(log2(n)+1))-1,0ll;
      |                                    ^
# Verdict Execution time Memory Grader output
1 Correct 27 ms 80024 KB Output is correct
2 Correct 27 ms 80000 KB Output is correct
3 Correct 80 ms 81748 KB Output is correct
4 Correct 28 ms 80052 KB Output is correct
5 Correct 27 ms 80084 KB Output is correct
6 Correct 4 ms 8148 KB Output is correct
7 Correct 4 ms 8148 KB Output is correct
8 Correct 4 ms 8148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8148 KB Output is correct
2 Correct 4 ms 8164 KB Output is correct
3 Correct 4 ms 8124 KB Output is correct
4 Correct 4 ms 9300 KB Output is correct
5 Correct 5 ms 9300 KB Output is correct
6 Correct 4 ms 9300 KB Output is correct
7 Correct 4 ms 9300 KB Output is correct
8 Correct 4 ms 9300 KB Output is correct
9 Correct 6 ms 9300 KB Output is correct
10 Correct 4 ms 9300 KB Output is correct
11 Correct 62 ms 10436 KB Output is correct
12 Correct 5 ms 9300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 28292 KB Output is correct
2 Correct 56 ms 28244 KB Output is correct
3 Correct 71 ms 28244 KB Output is correct
4 Correct 75 ms 28296 KB Output is correct
5 Correct 68 ms 28296 KB Output is correct
6 Correct 4 ms 8148 KB Output is correct
7 Correct 4 ms 8148 KB Output is correct
8 Correct 4 ms 8148 KB Output is correct
9 Correct 210 ms 28300 KB Output is correct
10 Correct 5 ms 8148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 98280 KB Output is correct
2 Correct 34 ms 98380 KB Output is correct
3 Correct 35 ms 98364 KB Output is correct
4 Correct 63 ms 99144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 28300 KB Output is correct
2 Correct 56 ms 28300 KB Output is correct
3 Correct 84 ms 28268 KB Output is correct
4 Correct 89 ms 28296 KB Output is correct
5 Correct 72 ms 28284 KB Output is correct
6 Correct 36 ms 98212 KB Output is correct
7 Correct 33 ms 98300 KB Output is correct
8 Correct 47 ms 98224 KB Output is correct
9 Correct 69 ms 99148 KB Output is correct
10 Correct 27 ms 80084 KB Output is correct
11 Correct 31 ms 79972 KB Output is correct
12 Correct 79 ms 81836 KB Output is correct
13 Correct 27 ms 80024 KB Output is correct
14 Correct 32 ms 80032 KB Output is correct
15 Correct 4 ms 8136 KB Output is correct
16 Correct 9 ms 8088 KB Output is correct
17 Correct 4 ms 8148 KB Output is correct
18 Correct 5 ms 9300 KB Output is correct
19 Correct 5 ms 9300 KB Output is correct
20 Correct 5 ms 9300 KB Output is correct
21 Correct 4 ms 9300 KB Output is correct
22 Correct 4 ms 9244 KB Output is correct
23 Correct 6 ms 9300 KB Output is correct
24 Correct 4 ms 9300 KB Output is correct
25 Correct 58 ms 10420 KB Output is correct
26 Correct 4 ms 9300 KB Output is correct
27 Correct 213 ms 28296 KB Output is correct
28 Runtime error 178 ms 262144 KB Execution killed with signal 9
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 28344 KB Output is correct
2 Correct 58 ms 28236 KB Output is correct
3 Correct 70 ms 28228 KB Output is correct
4 Correct 71 ms 28244 KB Output is correct
5 Correct 67 ms 28244 KB Output is correct
6 Correct 38 ms 98252 KB Output is correct
7 Correct 34 ms 98284 KB Output is correct
8 Correct 35 ms 98320 KB Output is correct
9 Correct 62 ms 99000 KB Output is correct
10 Correct 26 ms 80084 KB Output is correct
11 Correct 27 ms 80008 KB Output is correct
12 Correct 87 ms 81668 KB Output is correct
13 Correct 27 ms 79996 KB Output is correct
14 Correct 31 ms 80096 KB Output is correct
15 Runtime error 303 ms 262144 KB Execution killed with signal 9
16 Halted 0 ms 0 KB -