Submission #217184

# Submission time Handle Problem Language Result Execution time Memory
217184 2020-03-29T07:51:14 Z tselmegkh Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "secret.h"
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 1e5 + 5, inf = 1e9;
#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define sz(x) (int)x.size()
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int ans[1005][1005];

void solve(int l, int r, vi a){
	if(l == r){
		ans[l][r] = Secret(a[l], a[r]);
		return;
	}
	int mid = (l + r) / 2;
	for(int i = mid; i >= l; i--){
		if(i == mid)ans[i][mid] = Secret(a[mid], a[mid]);
		else ans[i][mid] = Secret(a[i], ans[i + 1][mid]);
	}
	for(int i = mid + 1; i <= r; i++){
		if(i == mid + 1)ans[mid + 1][i] = Secret(a[mid + 1], a[mid + 1]);
		else ans[mid + 1][i] = Secret(ans[mid + 1][i - 1], a[i]);
	}
	for(int i = l; i <= mid; i++){
		for(int j = mid + 1; j <= r; j++){
			ans[i][j] = Secret(ans[i][mid], ans[mid + 1][j]);
		}
	}
	solve(l, mid, a);
	solve(mid + 1, r, a);
}
void Init(int n, vi a){
	solve(0, n - 1, a);
}
int Query(int l, int r){
	return ans[l][r];
}

Compilation message

/tmp/cca5Tehn.o: In function `main':
grader-full.cpp:(.text.startup+0x27b): undefined reference to `Init(int, int*)'
collect2: error: ld returned 1 exit status