Submission #308889

# Submission time Handle Problem Language Result Execution time Memory
308889 2020-10-02T07:16:02 Z syy Secret (JOI14_secret) C++17
0 / 100
512 ms 8568 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 Incorrect 134 ms 4472 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 132 ms 4472 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 135 ms 4448 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 498 ms 8300 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 494 ms 8312 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 506 ms 8312 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 512 ms 8312 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 496 ms 8312 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 509 ms 8568 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 501 ms 8440 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.