#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==l) return;
if(m!=r) populate(l, m);
if(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]= 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;
| ~~~~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
113 ms |
4456 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 302456551. |
2 |
Incorrect |
114 ms |
4380 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 835389865. |
3 |
Incorrect |
115 ms |
4540 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 671121472. |
4 |
Incorrect |
419 ms |
12312 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 369623249. |
5 |
Incorrect |
419 ms |
12208 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 831147074. |
6 |
Incorrect |
420 ms |
12136 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 31281100. |
7 |
Incorrect |
430 ms |
12112 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 62926954. |
8 |
Incorrect |
420 ms |
12140 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 476393736. |
9 |
Incorrect |
421 ms |
12108 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 407113798. |
10 |
Incorrect |
425 ms |
12144 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 269230347. |