Submission #605860

# Submission time Handle Problem Language Result Execution time Memory
605860 2022-07-26T03:47:00 Z kawaii Secret (JOI14_secret) C++14
0 / 100
513 ms 8220 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 = 0;
    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 119 ms 4300 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 559309193.
2 Incorrect 123 ms 4296 KB Wrong Answer: Query(214, 350) - expected : 750452896, actual : 58208744.
3 Incorrect 129 ms 4384 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 229064728.
4 Incorrect 439 ms 8140 KB Wrong Answer: Query(193, 615) - expected : 280593123, actual : 99320041.
5 Incorrect 465 ms 8208 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 977966366.
6 Incorrect 447 ms 8144 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 536870912.
7 Incorrect 449 ms 8140 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 7410777.
8 Partially correct 498 ms 8124 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8
9 Incorrect 473 ms 8136 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 407246597.
10 Partially correct 513 ms 8220 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8