Submission #308888

# Submission time Handle Problem Language Result Execution time Memory
308888 2020-10-02T07:14:48 Z syy Secret (JOI14_secret) C++17
0 / 100
803 ms 524292 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

int res[1005][1005];

void dnc(int s, int e) {
	if (s+1 == e) return;
	int mid = (s+e)/2;
	DEC(i, mid-1, s) if (res[i][mid] == -1) res[i][mid] = Secret(res[i][i], res[i+1][mid]);
	FOR(i, mid+1, e) if (res[mid+1][i] == -1) res[mid+1][i] = Secret(res[i][i], res[mid+1][i-1]);
	dnc(s, mid);
	dnc(mid+1, e);
}

void Init(int n, int A[]) {
	FOR(i, 0, n-1) FOR(j, 0, n-1) res[i][j] = -1;
	FOR(i, 0, n-1) res[i][i] = A[i];
	dnc(0, n-1);
}

int Query(int l, int r) {
	FOR(i, l, r-1) if (res[l][i] != -1 and res[i+1][r] != -1) return Secret(res[l][i], res[i+1][r]);
	return res[l][r];
}
# Verdict Execution time Memory Grader output
1 Runtime error 443 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Incorrect 134 ms 4348 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Runtime error 433 ms 524288 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 792 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 798 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 794 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 803 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 802 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 795 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 803 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)