답안 #605893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
605893 2022-07-26T04:13:48 Z kawaii 비밀 (JOI14_secret) C++14
30 / 100
496 ms 8428 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 = 1; i <= N; i++) a[i] = A[i - 1];
    for(int i = 1; i <= N; i++) pre[i][i] = a[i];
    for(int i = 1; i <= 9; i++){
        for(int j = 1; 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 = -1; L++; R++;
    int diff = R - L + 1;
    // cout << diff <<" ";
    for(int i = 0; i <= 9; i++){
        if((1 << i) & diff){
            if(ans == -1) ans = pre[L][L + (1 << i) - 1];
            else ans = Secret(ans, pre[L][L + (1 << i) - 1]);
            L += (1 << i);
        }
    }
    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]);
      |                                                                                           ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 140 ms 4428 KB Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7
2 Partially correct 142 ms 4456 KB Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 7
3 Partially correct 149 ms 4536 KB Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 7
4 Partially correct 496 ms 8208 KB Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8
5 Partially correct 461 ms 8224 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8
6 Partially correct 437 ms 8268 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 2
7 Partially correct 477 ms 8304 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8
8 Partially correct 462 ms 8304 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7
9 Partially correct 478 ms 8272 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8
10 Partially correct 458 ms 8428 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7