Submission #738057

# Submission time Handle Problem Language Result Execution time Memory
738057 2023-05-08T06:41:46 Z anusha777 Secret (JOI14_secret) C++14
0 / 100
20000 ms 12268 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;
vvi ldp, rdp;
vi a;
int n;
void populate(int l, int r)
{
    if(l>=r) return;
    int m= (l+r)/2;
    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]);
    populate(l, m);
    populate(m, r);
}
void Init(int m, int A[])
{
    n=m;
    ldp.resize(n, vi(n));
    rdp.resize(n, vi(n));
    a.resize(n);
    forr(i, 0, n) a[i]=ldp[i][i]=rdp[i][i]=A[i];
    populate(0, n);
}
int query(int lx, int rx, int l, int r)
{
    int mx= (lx+rx)/2;
    if(mx>=l and mx<r) return Secret( ldp[mx][l], rdp[mx][r]);
    if(r<=mx) return query(lx, mx, l, r);
    return query(mx, rx,l, r); 
}
int Query(int l, int r)
{
    return query(0, n, l, r+1);
}

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 Execution timed out 20005 ms 4412 KB Time limit exceeded
2 Execution timed out 20073 ms 4504 KB Time limit exceeded
3 Execution timed out 20050 ms 4440 KB Time limit exceeded
4 Execution timed out 20080 ms 12248 KB Time limit exceeded
5 Execution timed out 20038 ms 12168 KB Time limit exceeded
6 Execution timed out 20074 ms 12268 KB Time limit exceeded
7 Execution timed out 20062 ms 12136 KB Time limit exceeded
8 Execution timed out 20096 ms 12244 KB Time limit exceeded
9 Execution timed out 20046 ms 12260 KB Time limit exceeded
10 Execution timed out 20062 ms 12260 KB Time limit exceeded