Submission #542660

# Submission time Handle Problem Language Result Execution time Memory
542660 2022-03-27T13:03:10 Z __Variatto Secret (JOI14_secret) C++17
0 / 100
467 ms 4316 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=1e3+10, L=10;
int n, daq[MAX][L+2], q, a, b, t[MAX], pot;
/*int Secret(int a, int b){
    return a*b;
}
*/int Query(int l, int r){
    if(l==r) return t[l];
    int x=32-__builtin_clz(l^r);
    return Secret(daq[l][x], daq[r][x]);
}
void rek(int pocz, int kon, int nr){
    if(pocz==kon){
        daq[pocz][nr]=t[pocz];
        return;
    }
    int sr=(pocz+kon)/2;
    daq[sr][nr]=t[sr];
    for(int i=sr-1; i>=pocz; i--)
        daq[i][nr]=Secret(t[i], daq[i+1][nr]);
    if(sr+1<=kon)
        daq[sr+1][nr]=t[sr+1];
    for(int i=sr+2; i<=kon; i++)
        daq[i][nr]=Secret(daq[i-1][nr], t[i]);
    rek(pocz, sr, nr-1);
    rek(sr+1, kon, nr-1);
}
void Init(int N, int A[]){
    n=N;
    for(int i=0; i<n; i++)
        t[i]=A[i];
    while((1<<pot)<n) pot++;
    rek(0, n-1, pot);
}
/*int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n1;
    cin>>n1;
    int A1[n1];
    for(int i=0; i<n1; i++) cin>>A1[i];
    Init(n1, A1);
    int q1;
    cin>>q1;
    while(q1--){
        int a, b;
        cin>>a>>b;
        cout<<Query(a, b)<<"\n";
    }
}
*/
# Verdict Execution time Memory Grader output
1 Correct 124 ms 2404 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Correct 126 ms 2364 KB Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1
3 Incorrect 117 ms 2380 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 471212.
4 Incorrect 439 ms 4296 KB Wrong Answer: Query(877, 959) - expected : 912310978, actual : 598262492.
5 Incorrect 433 ms 4300 KB Wrong Answer: Query(761, 790) - expected : 112945480, actual : 955460636.
6 Incorrect 448 ms 4316 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 111478025.
7 Correct 447 ms 4288 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 445 ms 4296 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 467 ms 4260 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 449 ms 4260 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1