# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
25331 |
2017-06-21T07:38:10 Z |
dotorya |
Secret (JOI14_secret) |
C++14 |
|
639 ms |
6640 KB |
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
#define mp make_pair
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#include "secret.h"
map <int, int> Mx1[1050];
map <int, int> Mx2[1050];
int mySecret(int a, int b) {
if (a == -1) return b;
if (b == -1) return a;
return Secret(a, b);
}
void Init(int N, int A[]) {
int i, j;
for (i = N; i >= 1; i--) {
int prv = -1;
for (j = i; j <= N; j += j & (-j)) {
if (i == j) Mx1[i][i] = A[i-1];
else Mx1[i][j] = mySecret(Mx1[i][prv], Mx1[prv + 1][j]);
prv = j;
}
}
for (i = 1; i <= N; i++) {
int prv = -1;
for (j = i; j; j -= j & (-j)) {
if (i == j) Mx2[i][j] = -1;
else if (j + 1 == i) Mx2[i][j] = A[i-1];
else Mx2[i][j] = mySecret(Mx2[prv][j], Mx2[i][prv]);
prv = j;
}
}
}
int Query(int L, int R) {
L++, R++;
set <int> Su1;
set <int> Su2;
for (int t = L; t <= R; t += t & (-t)) Su1.insert(t);
for (int t = R; t >= L; t -= t & (-t)) {
if (Su1.count(t)) return mySecret(Mx1[L][t], Mx2[R][t]);
}
return 0;
}
Compilation message
secret.cpp:23:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:4996)
^
secret.cpp:24:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(linker, "/STACK:336777216")
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
169 ms |
6376 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 559293107. |
2 |
Incorrect |
159 ms |
6376 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064. |
3 |
Incorrect |
169 ms |
6376 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 832778340. |
4 |
Incorrect |
579 ms |
6640 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 610402471. |
5 |
Incorrect |
569 ms |
6640 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 551081280. |
6 |
Incorrect |
599 ms |
6640 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 814309816. |
7 |
Incorrect |
599 ms |
6640 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 548014137. |
8 |
Incorrect |
569 ms |
6640 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 549966088. |
9 |
Incorrect |
596 ms |
6640 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 155322121. |
10 |
Incorrect |
639 ms |
6640 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 339124224. |