Submission #930626

# Submission time Handle Problem Language Result Execution time Memory
930626 2024-02-20T08:26:43 Z oblantis Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int inf = 1e9;
const int mod = 1e9+7;
const int maxn = 1e6 + 1;
//int secret_count;
map<pii, int> sh;
//int Secret(int X, int Y) {
  //++secret_count;
  //return (X + 2 * (Y / 2));
//}
void go(int l, int r){
	if(l + 2 >= r)return;
	int mid = l + (r - l) / 2;
	for(int i = mid - 2; i >= l; i--){
		sh[{i, mid - 1}] = Secret(sh[{i, i}], sh[{i + 1, mid - 1}]);
	}
	for(int i = mid + 1; i <= r; i++){
		sh[{mid, i}] = Secret(sh[{mid, i - 1}], sh[{i, i}]);
	}
	go(l, mid);
	go(mid, r);
}
void Init(int n, int a[]) {
	for(int i = 0; i < n; i++){
		sh[{i, i}] = a[i];
	}
	go(0, n);
}
int Query(int l, int r) {
	if(sh.find({l, r}) != sh.end())return sh[{l, r}];
	for(int j = l; j < r; j++){
		if(sh.find({l, j}) != sh.end() && sh.find({j + 1, r}) != sh.end()){
			return Secret(sh[{l, j}], sh[{j + 1, r}]);
		}
	}
	return 0;
}
//int main(){
	//int n;
	//cin >> n;
	//int a[n];
	//for(int i = 0; i < n; i++){
		//cin >> a[i];
	//}
	//Init(n, a);
	//int q;
	//cin >> q;
	//while(q--){
		//int l, r;
		//cin >> l >> r;
		//cout << Query(l, r) << '\n';
	//}
	//return 0;
//}

Compilation message

secret.cpp: In function 'void go(int, int)':
secret.cpp:25:22: error: 'Secret' was not declared in this scope
   25 |   sh[{i, mid - 1}] = Secret(sh[{i, i}], sh[{i + 1, mid - 1}]);
      |                      ^~~~~~
secret.cpp:28:18: error: 'Secret' was not declared in this scope
   28 |   sh[{mid, i}] = Secret(sh[{mid, i - 1}], sh[{i, i}]);
      |                  ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:43:11: error: 'Secret' was not declared in this scope
   43 |    return Secret(sh[{l, j}], sh[{j + 1, r}]);
      |           ^~~~~~