Submission #605856

# Submission time Handle Problem Language Result Execution time Memory
605856 2022-07-26T03:46:19 Z kawaii Secret (JOI14_secret) C++14
0 / 100
507 ms 8296 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;

int a[1005], pre[1005][1005];

void Init(int N, int A[]){
    for(int i = 0; i < N; i++) a[i] = A[i];
    for(int i = 0; i < N - 1; i++) pre[i][i + 1] = Secret(a[i], a[i + 1]);
    for(int i = 2; i <= 9; i++){
        for(int j = 0; j + (1 << i) - 1 < N; j++){
            pre[j][j + (1 << i) - 1] = Secret(pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]);
        }
    }
}

int Query(int L, int R){
    int ans = a[L];
    int diff = R - L + 1;
    while(diff){
        int p = (diff & -diff);
        // cout << diff <<" "<< p << "\n";
        ans = Secret(ans, pre[L][L + p - 1]);
        diff -= p; L += p;
    }
    return ans;
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:12:66: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   12 |             pre[j][j + (1 << i) - 1] = Secret(pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]);
      |                                                                ~~^~~
secret.cpp:12:93: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   12 |             pre[j][j + (1 << i) - 1] = Secret(pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]);
      |                                                                                           ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 4376 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537.
2 Incorrect 113 ms 4380 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 700627393.
3 Incorrect 115 ms 4496 KB Wrong Answer: Query(334, 369) - expected : 363022362, actual : 942004578.
4 Incorrect 413 ms 8144 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 281067741.
5 Incorrect 421 ms 8296 KB Wrong Answer: Query(263, 292) - expected : 653448456, actual : 110120978.
6 Incorrect 420 ms 8140 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 278446241.
7 Incorrect 429 ms 8176 KB Wrong Answer: Query(18, 983) - expected : 662702203, actual : 21599257.
8 Incorrect 433 ms 8148 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 285554968.
9 Partially correct 507 ms 8208 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 9
10 Incorrect 434 ms 8268 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70725250.