# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
390851 |
2021-04-17T08:29:51 Z |
hhhhaura |
Secret (JOI14_secret) |
C++14 |
|
833 ms |
524292 KB |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))
#define INF 1e9
#define MOD 1000000007
#define eps (1e-9)
#define MAXN 2000
#define lld long double
#define pii pair<int ,int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L; }
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); }
#else
#define print(...) 0
#define vprint(...) 0
#endif
int n, b[32][MAXN], a[MAXN];
int Secret(int, int);
void build(int d, int L, int R) {
if(L == R) b[d][L] = a[L];
else {
int mid = (L + R) / 2;
build(d + 1, L, mid);
build(d + 1, mid + 1, R);
b[d][mid] = a[mid];
b[d][mid + 1] = a[mid + 1];
rrep(i, L, mid - 1) b[d][i] = Secret(a[i], b[d][i + 1]);
rep(i, mid + 2, R) b[d][i] = Secret(b[d][i - 1], a[i]);
print(d);
rep(i, L, R) print(b[d][i]);
}
}
int query(int d, int L, int R, int l, int r) {
int mid = (L + R) / 2;
if(l > R || r < L) return INF;
else if(l <= mid && r >= mid + 1)
return Secret(b[d][l], b[d][r]);
else return min(
query(d + 1, L, mid, l, r),
query(d + 1, mid + 1, R, l, r)
);
}
void Init(int N, int A[]) {
n = N;
rep(i, 0, n - 1) a[i] = A[i];
vprint(a, a + n);
print(n);
build(1, 0, n - 1);
return;
}
int Query(int L, int R) {
return query(1, 0, n - 1, L, R);
}
Compilation message
secret.cpp:3: warning: ignoring #pragma loop [-Wunknown-pragmas]
3 | #pragma loop-opt(on)
|
secret.cpp: In function 'void build(int, int, int)':
secret.cpp:26:20: warning: statement has no effect [-Wunused-value]
26 | #define print(...) 0
| ^
secret.cpp:41:3: note: in expansion of macro 'print'
41 | print(d);
| ^~~~~
secret.cpp:26:20: warning: statement has no effect [-Wunused-value]
26 | #define print(...) 0
| ^
secret.cpp:42:16: note: in expansion of macro 'print'
42 | rep(i, L, R) print(b[d][i]);
| ^~~~~
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:27:21: warning: statement has no effect [-Wunused-value]
27 | #define vprint(...) 0
| ^
secret.cpp:58:2: note: in expansion of macro 'vprint'
58 | vprint(a, a + n);
| ^~~~~~
secret.cpp:26:20: warning: statement has no effect [-Wunused-value]
26 | #define print(...) 0
| ^
secret.cpp:59:2: note: in expansion of macro 'print'
59 | print(n);
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
467 ms |
524292 KB |
Execution killed with signal 9 |
2 |
Runtime error |
446 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Runtime error |
443 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Runtime error |
802 ms |
524292 KB |
Execution killed with signal 9 |
5 |
Runtime error |
801 ms |
524292 KB |
Execution killed with signal 9 |
6 |
Runtime error |
833 ms |
524292 KB |
Execution killed with signal 9 |
7 |
Correct |
506 ms |
4440 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
513 ms |
4480 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
514 ms |
4420 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
505 ms |
4412 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |