답안 #116004

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116004 2019-06-10T07:09:20 Z minhcool 비밀 (JOI14_secret) C++17
0 / 100
541 ms 4548 KB
#include<bits/stdc++.h>
#include "secret.h"
using namespace std;

int ans[1001][11], n, b[1001];

int ask(int x, int y){
    return Secret(x, y);
}

void build(){
    for(int i = 1; i <= n; i++) ans[i][0] = b[i];
    for(int i = 1; i < 10; i++){
        int tmp = 1 << i;
        for(int j = 1; j + tmp <= n; j++) ans[j][i] = ask(ans[j][i - 1], ans[j + (1 << (i - 1))][i - 1]);
    }
}

void Init(int N, int A[]){
    n = N;
    for(int i = 1; i <= n; i++) b[i] = A[i - 1];
    build();
}

int Query(int x, int y){
    x++;
    y++;
    int tmp = x, answer = 0;
    for(int i = 9; i >= 0; i--){
        if(tmp + (1 << i) > (y + 1)) continue;
        if(!answer) answer = ans[tmp][i];
        else answer = ask(answer, ans[tmp][i]);
        tmp += (1 << i);
    }
    return answer;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 137 ms 2524 KB Wrong Answer: Query(173, 510) - expected : 37908721, actual : 50558859.
2 Incorrect 132 ms 2472 KB Wrong Answer: Query(332, 511) - expected : 666908073, actual : 783978720.
3 Incorrect 134 ms 2468 KB Wrong Answer: Query(231, 512) - expected : 337782798, actual : 965914724.
4 Incorrect 490 ms 4448 KB Wrong Answer: Query(425, 998) - expected : 547995664, actual : 342606422.
5 Incorrect 493 ms 4472 KB Wrong Answer: Query(508, 999) - expected : 756552004, actual : 915967002.
6 Incorrect 487 ms 4548 KB Wrong Answer: Query(990, 999) - expected : 570594834, actual : 18031954.
7 Incorrect 493 ms 4476 KB Wrong Answer: Query(28, 999) - expected : 660607002, actual : 207854635.
8 Incorrect 486 ms 4344 KB Wrong Answer: Query(90, 999) - expected : 617673048, actual : 902055944.
9 Partially correct 541 ms 4444 KB Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8
10 Incorrect 487 ms 4472 KB Wrong Answer: Query(4, 999) - expected : 420612, actual : 4286415.