# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
366604 |
2021-02-14T19:20:46 Z |
idk321 |
Secret (JOI14_secret) |
C++11 |
|
561 ms |
43756 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "secret.h"
const int N = 1000;
int val[N][9];
int* ar;
vector<int> need[N][N];
void cost(int a, int b)
{
if (a == b)
{
need[a][b].push_back(ar[a]);
return;
} else if (a == b - 1)
{
need[a][a].push_back(ar[a]);
need[b][b].push_back(ar[b]);
need[a][b].push_back(ar[a]);
need[a][b].push_back(ar[b]);
return;
}
int mid = (a + b) / 2;
vector<int> l(N);
l[mid] = ar[mid];
int cur = ar[mid];
need[mid][mid].push_back(cur);
for (int i = mid - 1; i >= a; i--)
{
cur = Secret(cur, ar[i]);
need[i][mid].push_back(cur);
}
cur = ar[mid + 1];
need[mid + 1][mid + 1].push_back(cur);
for (int i = mid + 2; i <= b; i++)
{
cur = Secret(cur, ar[i]);
need[mid + 1][i].push_back(cur);
}
for (int i = mid; i >= a; i--)
{
for (int j = mid + 1; j <= b; j++)
{
need[i][j].push_back(need[i][mid][0]);
need[i][j].push_back(need[mid + 1][j][0]);
}
}
cost(a, mid - 1);
cost(mid + 1, b);
}
/*
int main()
{
} */
void Init(int n, int A[])
{
ar = A;
cost(0, n - 1);
}
int Query(int l, int r)
{
if (need[l][r].size() == 1) return need[l][r][0];
return Secret(need[l][r][0], need[l][r][1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
158 ms |
30060 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
162 ms |
30060 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
161 ms |
30188 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
556 ms |
43628 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
555 ms |
43756 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
561 ms |
43756 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 850129153. |
7 |
Incorrect |
558 ms |
43756 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
558 ms |
43628 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
560 ms |
43756 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
556 ms |
43756 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |