# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
914812 |
2024-01-22T17:33:08 Z |
mike |
Secret (JOI14_secret) |
C++14 |
|
379 ms |
9044 KB |
#include <vector>
#include <iostream>
#include "secret.h"
using namespace std;
/*int Secret(int x, int y){
return min(x+y-y%2, 1000000000);
}*/
int tree[4005][1005];
int arr[1005];
int tam;
void segment_tree(int pos, int ini, int fin){
if(ini == fin){
tree[pos][ini]=arr[ini];
return;
}
if(ini == fin-1){
return;
}
int mitad=(ini+fin)/2;
tree[pos][mitad-1]=arr[mitad-1];
for(int c=mitad-2; c >= ini; c--){
tree[pos][c]=Secret(arr[c], tree[pos][c+1]);
}
tree[pos][mitad]=arr[mitad];
for(int c=mitad+1; c < fin; c++){
tree[pos][c]=Secret(arr[c], tree[pos][c-1]);
}
segment_tree(pos*2, ini, mitad);
segment_tree(pos*2+1, mitad+1, fin);
}
void Init(int N, int A[]){
tam=N;
for(int c=0; c < N; c++){
arr[c]=A[c];
}
segment_tree(1, 0, N);
}
int ayuda(int pos, int ini, int fin, int l, int r){
int mitad=(ini+fin)/2;
if(l == r)
return arr[l];
if(l == r-1)
return Secret(arr[l], arr[r]);
if(l <= mitad && r >= mitad){
return Secret(tree[pos][l], tree[pos][r]);
}
if(l >= mitad){
return ayuda(pos*2+1, mitad+1, fin, l, r);
}
else
return ayuda(pos*2, ini, mitad, l , r);
}
int Query(int L, int R){
if(L == R)
return arr[L];
if(L == R-1)
return Secret(arr[L], arr[R]);
return ayuda(1, 0, tam, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
101 ms |
6740 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 319912893. |
2 |
Incorrect |
102 ms |
6740 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Incorrect |
101 ms |
8784 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996. |
4 |
Incorrect |
378 ms |
8980 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 327860453. |
5 |
Incorrect |
370 ms |
8788 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838. |
6 |
Incorrect |
373 ms |
9044 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050. |
7 |
Incorrect |
374 ms |
8788 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570. |
8 |
Incorrect |
379 ms |
8796 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264. |
9 |
Incorrect |
377 ms |
8664 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135. |
10 |
Incorrect |
378 ms |
8784 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726. |