# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
242401 |
2020-06-27T15:25:27 Z |
AM1648 |
Secret (JOI14_secret) |
C++17 |
|
20000 ms |
4600 KB |
/* be name khoda */
// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
#include "secret.h"
using namespace std;
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif
typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;
#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))
#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;
#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD
// -----------------------------------------------------------------------
const ll maxn = 1002;
const ll maxnlg = 10;
ll n, A[maxn];
ll pre[maxnlg][maxn];
void calc(ll h, ll l, ll r) {
if (r - l <= 2) return;
ll mid = (l + r) / 2;
pre[h][mid] = A[mid], pre[h][mid - 1] = A[mid - 1];
forifrom (i, mid + 1, r) pre[h][i] = Secret(pre[h][i - 1], A[i]);
forir (i, mid - 1) pre[h][i] = Secret(pre[h][i + 1], A[i]);
calc(h + 1, l, mid);
calc(h + 1, mid, r);
}
ll find(ll L, ll R, ll h = 0, ll l = 0, ll r = n) {
ll mid = (l + r) / 2;
if (L >= mid) return find(L, R, h + 1, l, mid);
if (R <= mid) return find(L, R, h + 1, mid, r);
else return Secret(pre[h][L], pre[h][R - 1]);
}
void Init(ll N, ll I[]) {
n = N;
fori (i, n) A[i] = I[i];
calc(0, 0, n);
}
ll Query(ll l, ll r) {
++r;
if (r - l == 1) return A[l];
else if (r - l == 2) return Secret(A[l], A[l + 1]);
else return find(l, r);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
20027 ms |
2552 KB |
Time limit exceeded |
2 |
Incorrect |
199 ms |
2552 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
205 ms |
2552 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 162768982. |
4 |
Execution timed out |
20082 ms |
4472 KB |
Time limit exceeded |
5 |
Execution timed out |
20050 ms |
4600 KB |
Time limit exceeded |
6 |
Execution timed out |
20016 ms |
4472 KB |
Time limit exceeded |
7 |
Incorrect |
751 ms |
4500 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
734 ms |
4472 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
750 ms |
4472 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
747 ms |
4600 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |