# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
65525 |
2018-08-07T20:37:38 Z |
reality |
Secret (JOI14_secret) |
C++17 |
|
654 ms |
8924 KB |
#include "secret.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int NN = 1024;
int G[NN][NN];
int n;
void go(int l,int r) {
if (l == r)
return;
int m = (l + r) / 2;
go(l,m);
go(m+1,r);
for (int i = m;i >= l;--i)
if (G[i][m + 1] == -1) {
for (int t = i;G[i][m + 1] == -1 && t <= m;++t)
if (G[i][t] != -1 && G[t + 1][m + 1] != -1)
G[i][m + 1] = Secret(G[i][t],G[t + 1][m + 1]);
assert(G[i][m + 1] != -1);
}
for (int i = m + 1;i <= r;++i)
if (G[m][i] == -1) {
for (int t = m;t < i && G[m][i] == -1;++t)
if (G[m][t] != -1 && G[t + 1][i] != -1)
G[m][i] = Secret(G[m][t],G[t + 1][i]);
assert(G[m][i] != -1);
}
}
void Init(int N, int A[]) {
int n = N;
memset(G,-1,sizeof(G));
for (int i = 0;i < n;++i)
G[i][i] = A[i];
go(0,n - 1);
}
int Query(int L, int R) {
if (G[L][R] != -1)
return G[L][R];
for (int k = L;k < R;++k)
if (G[L][k] != -1 && G[k + 1][R] != -1)
return G[L][R] = Secret(G[L][k],G[k + 1][R]);
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
172 ms |
6520 KB |
Wrong Answer: Query(113, 206) - expected : 536899947, actual : 93. |
2 |
Incorrect |
170 ms |
6628 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 315. |
3 |
Incorrect |
171 ms |
6704 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 190. |
4 |
Incorrect |
629 ms |
8560 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 407. |
5 |
Incorrect |
631 ms |
8688 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 328. |
6 |
Incorrect |
654 ms |
8776 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |
7 |
Incorrect |
641 ms |
8776 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 892. |
8 |
Incorrect |
603 ms |
8776 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 929. |
9 |
Incorrect |
628 ms |
8924 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 934. |
10 |
Incorrect |
612 ms |
8924 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 845. |