답안 #790481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
790481 2023-07-22T17:26:13 Z Andrey 비밀 (JOI14_secret) C++14
6 / 100
399 ms 4600 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;

int pr[1001][10];
int su[1001][10];

void Init(int n, int a[]) {
    for(int i = 0; i < n; i++) {
        pr[i][0] = a[i];
        su[i][0] = a[i];
    }
    for(int i = 1; i < 10; i++) {
        for(int j = 0; j < n; j++) {
            if(j%(1 << i) < (1 << (i-1))) {
                pr[j][i] = pr[j][i-1];
            }
            else {
                pr[j][i] = Secret(pr[j-1][i],a[j]);
            }
        }
    }
    for(int i = 1; i < 10; i++) {
        for(int j = n-1; j >= 0; j--) {
            if(j%(1 << i) >= (1 << (i-1)) || j == n-1) {
                su[j][i] = su[j][i-1];
            }
            else {
                su[j][i] = Secret(a[j],su[j+1][i]);
            }
        }
    }
}

int Query(int l, int r) {
    if(l == r) {
        return pr[l][0];
    }
    for(int i = 0; i < 10; i++) {
        if(l/(1 << (i+1)) == r/(1 << (i+1))) {
            return Secret(su[l][i],pr[r][i]);
        }
    }
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 2472 KB Output is correct - number of calls to Secret by Init = 4598, maximum number of calls to Secret by Query = 1
2 Correct 111 ms 2452 KB Output is correct - number of calls to Secret by Init = 4608, maximum number of calls to Secret by Query = 1
3 Correct 110 ms 2492 KB Output is correct - number of calls to Secret by Init = 4608, maximum number of calls to Secret by Query = 1
4 Partially correct 393 ms 4600 KB Output isn't correct - number of calls to Secret by Init = 8988, maximum number of calls to Secret by Query = 1
5 Partially correct 383 ms 4436 KB Output isn't correct - number of calls to Secret by Init = 8998, maximum number of calls to Secret by Query = 1
6 Partially correct 399 ms 4440 KB Output isn't correct - number of calls to Secret by Init = 8998, maximum number of calls to Secret by Query = 1
7 Partially correct 382 ms 4352 KB Output isn't correct - number of calls to Secret by Init = 8998, maximum number of calls to Secret by Query = 1
8 Partially correct 385 ms 4372 KB Output isn't correct - number of calls to Secret by Init = 8998, maximum number of calls to Secret by Query = 1
9 Partially correct 385 ms 4440 KB Output isn't correct - number of calls to Secret by Init = 8998, maximum number of calls to Secret by Query = 1
10 Partially correct 388 ms 4428 KB Output isn't correct - number of calls to Secret by Init = 8998, maximum number of calls to Secret by Query = 1