Submission #930633

#TimeUsernameProblemLanguageResultExecution timeMemory
930633oblantisSecret (JOI14_secret)C++17
100 / 100
466 ms4908 KiB
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #pragma GCC optimize("O3,unroll-loops") #include "secret.h"; #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 + 1 >= 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 (stderr)

secret.cpp:3:20: warning: extra tokens at end of #include directive
    3 | #include "secret.h";
      |                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...