Submission #738038

# Submission time Handle Problem Language Result Execution time Memory
738038 2023-05-08T05:52:06 Z anusha777 Secret (JOI14_secret) C++14
0 / 100
467 ms 8544 KB
#include "secret.h"
#include <bits/stdc++.h>
#define fast 			ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL)
#define sz(x)			(int)((x).size())
#define pb				push_back
#define vi				vector<int>
#define vb				vector<bool>
#define vvb				vector<vb>
#define pi				pair<int,int>
#define vpi				vector<pi>
#define vvi				vector<vi>
#define vc				vector<char>
#define all(x)			x.begin(), x.end()
#define rall(x)			x.rbegin(), x.rend()
#define pbb()			pop_back()
#define f				first
#define s				second
#define ll				long long
//#define int				long long
#define ull				unsigned long long
#define line               cout<<"_____________________________"<<endl;
#define hash                cout<<"################"<<endl;
#define forr(i, a, b)      for(int i=a; i<b; i++)
using namespace std;
const int N=1e5+1, mod=1e9+7, inf=1e18+1;
vi a;
vvi ldp, rdp;
int n;
void populate(int l, int r)
{
    int m= (l+r)/2;
    ldp[m][m]=rdp[m][m]=a[m];
    for(int i=m+1; i<=r; i++) rdp[m][i]= Secret(rdp[m][i-1], a[i]);
    for(int i=m-1; i>=l; i--) ldp[m][i]= Secret(ldp[m][i+1],a[i]);
    if(r!=m) populate(l, m);
    if(l!=m) populate(m, r);
}
void Init(int m, int A[])
{
    ldp.resize(n, vi(n));
    rdp.resize(n, vi(n));
    a.resize(n);
    forr(i, 0, n) a[i]= A[i];
    populate(0, n-1);
}
int query(int lx, int rx, int l, int r)
{
    int mx=(lx+rx)/2;
    if(r<mx) return query(lx, mx, l, r);
    if(mx<l) return query(mx, rx, l, r);
    return Secret(ldp[mx][l], rdp[mx][r]);
}
int Query(int l, int r)
{
    return query(0, n-1, l, r);
}

Compilation message

secret.cpp:25:39: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   25 | const int N=1e5+1, mod=1e9+7, inf=1e18+1;
      |                                   ~~~~^~
# Verdict Execution time Memory Grader output
1 Runtime error 118 ms 4640 KB Execution killed with signal 11
2 Runtime error 118 ms 4724 KB Execution killed with signal 11
3 Runtime error 114 ms 4696 KB Execution killed with signal 11
4 Runtime error 425 ms 8520 KB Execution killed with signal 11
5 Runtime error 428 ms 8544 KB Execution killed with signal 11
6 Runtime error 443 ms 8504 KB Execution killed with signal 11
7 Runtime error 436 ms 8516 KB Execution killed with signal 11
8 Runtime error 467 ms 8472 KB Execution killed with signal 11
9 Runtime error 443 ms 8520 KB Execution killed with signal 11
10 Runtime error 438 ms 8508 KB Execution killed with signal 11