답안 #783100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783100 2023-07-14T15:26:36 Z tolbi 웜뱃 (IOI13_wombats) C++17
55 / 100
345 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;
      |                                    ^
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 80084 KB Output is correct
2 Correct 32 ms 80116 KB Output is correct
3 Correct 82 ms 81996 KB Output is correct
4 Correct 27 ms 80072 KB Output is correct
5 Correct 26 ms 80024 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
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8148 KB Output is correct
2 Correct 4 ms 8144 KB Output is correct
3 Correct 4 ms 8148 KB Output is correct
4 Correct 4 ms 9300 KB Output is correct
5 Correct 4 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 4 ms 9300 KB Output is correct
10 Correct 5 ms 9328 KB Output is correct
11 Correct 74 ms 10708 KB Output is correct
12 Correct 4 ms 9404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 28364 KB Output is correct
2 Correct 65 ms 28368 KB Output is correct
3 Correct 75 ms 28376 KB Output is correct
4 Correct 84 ms 28376 KB Output is correct
5 Correct 83 ms 28372 KB Output is correct
6 Correct 4 ms 8148 KB Output is correct
7 Correct 4 ms 8132 KB Output is correct
8 Correct 4 ms 8148 KB Output is correct
9 Correct 213 ms 28372 KB Output is correct
10 Correct 5 ms 8148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 98328 KB Output is correct
2 Correct 45 ms 98332 KB Output is correct
3 Correct 36 ms 98292 KB Output is correct
4 Correct 70 ms 99400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 28428 KB Output is correct
2 Correct 64 ms 28360 KB Output is correct
3 Correct 75 ms 28376 KB Output is correct
4 Correct 72 ms 28376 KB Output is correct
5 Correct 70 ms 28380 KB Output is correct
6 Correct 43 ms 98312 KB Output is correct
7 Correct 46 ms 98360 KB Output is correct
8 Correct 36 ms 98348 KB Output is correct
9 Correct 75 ms 99416 KB Output is correct
10 Correct 28 ms 80084 KB Output is correct
11 Correct 27 ms 80032 KB Output is correct
12 Correct 82 ms 81996 KB Output is correct
13 Correct 26 ms 80076 KB Output is correct
14 Correct 27 ms 80084 KB Output is correct
15 Correct 4 ms 8124 KB Output is correct
16 Correct 4 ms 8148 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 4 ms 9300 KB Output is correct
21 Correct 5 ms 9300 KB Output is correct
22 Correct 4 ms 9300 KB Output is correct
23 Correct 4 ms 9408 KB Output is correct
24 Correct 4 ms 9300 KB Output is correct
25 Correct 58 ms 10716 KB Output is correct
26 Correct 5 ms 9300 KB Output is correct
27 Correct 258 ms 28372 KB Output is correct
28 Runtime error 190 ms 262144 KB Execution killed with signal 9
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 28280 KB Output is correct
2 Correct 59 ms 28364 KB Output is correct
3 Correct 77 ms 28276 KB Output is correct
4 Correct 88 ms 28376 KB Output is correct
5 Correct 73 ms 28356 KB Output is correct
6 Correct 48 ms 98272 KB Output is correct
7 Correct 46 ms 98380 KB Output is correct
8 Correct 41 ms 98360 KB Output is correct
9 Correct 74 ms 99336 KB Output is correct
10 Correct 34 ms 80064 KB Output is correct
11 Correct 32 ms 80084 KB Output is correct
12 Correct 84 ms 81924 KB Output is correct
13 Correct 32 ms 80020 KB Output is correct
14 Correct 34 ms 80040 KB Output is correct
15 Runtime error 345 ms 262144 KB Execution killed with signal 9
16 Halted 0 ms 0 KB -