Submission #542664

# Submission time Handle Problem Language Result Execution time Memory
542664 2022-03-27T13:05:55 Z __Variatto Secret (JOI14_secret) C++17
0 / 100
454 ms 4556 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 ll MAX=1e3+10, L=10;
ll n, daq[MAX][L+2], q, a, b, t[MAX], pot;
/*ll Secret(ll a, ll b){
    return a*b;
}
*/int Query(int l, int r){
    if(l==r) return t[l];
    ll 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;
    }
    ll sr=(pocz+kon)/2;
    daq[sr][nr]=t[sr];
    for(ll 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(ll 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(ll i=0; i<n; i++)
        t[i]=A[i];
    while((1<<pot)<n) pot++;
    rek(0, n-1, pot);
}
/*ll main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    ll n1;
    cin>>n1;
    ll A1[n1];
    for(ll i=0; i<n1; i++) cin>>A1[i];
    Init(n1, A1);
    ll q1;
    cin>>q1;
    while(q1--){
        ll a, b;
        cin>>a>>b;
        cout<<Query(a, b)<<"\n";
    }
}
*/
# Verdict Execution time Memory Grader output
1 Correct 126 ms 2380 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Correct 125 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 118 ms 2416 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 471212.
4 Incorrect 430 ms 4468 KB Wrong Answer: Query(877, 959) - expected : 912310978, actual : 598262492.
5 Incorrect 430 ms 4360 KB Wrong Answer: Query(761, 790) - expected : 112945480, actual : 955460636.
6 Incorrect 437 ms 4416 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 111478025.
7 Correct 447 ms 4556 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 4292 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 454 ms 4400 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 448 ms 4312 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1