# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
737991 |
2023-05-08T04:21:09 Z |
anusha777 |
Secret (JOI14_secret) |
C++14 |
|
432 ms |
4300 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;
int n;
void Set(int x, int v, int i , int l, int r)
{
if(r-l==1)
{
a[x]=v;
return;
}
int m= (l+r)/2;
if(i<m) Set(2*x+1, v, i, l , m);
else Set(2*x+2, v, i, m , r);
a[x]= Secret(a[2*x+1], a[2*x+2]);
}
void Init(int m, int A[])
{
n=1;
while(n<m) n*=2;
a.resize(2*n-1);
forr(i, 0, n) Set(0, A[i], i, 0, n);
}
int query(int x, int lx, int rx, int l, int r)
{
if(l>=rx or lx>=r) return -1;
if(l>=lx and r<=rx) return a[x];
int mx= (lx+rx)/2;
int v1= query(2*x+1, lx, mx, l, r), v2= query(2*x+2, mx, rx, l, r);
if(v1!=-1 and v2!=-1) return Secret(v1, v2);
if(v1==-1) return v2;
return v1;
}
int Query(int l, int r)
{
return query(0, 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 |
Incorrect |
111 ms |
2380 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 303446001. |
2 |
Incorrect |
109 ms |
2252 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 401641632. |
3 |
Incorrect |
110 ms |
2376 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 2148728. |
4 |
Incorrect |
406 ms |
4168 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 119193659. |
5 |
Incorrect |
412 ms |
4236 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 485624132. |
6 |
Incorrect |
412 ms |
4172 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 965796969. |
7 |
Incorrect |
416 ms |
4172 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 547491865. |
8 |
Incorrect |
415 ms |
4296 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 482714640. |
9 |
Incorrect |
432 ms |
4284 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 939793997. |
10 |
Incorrect |
421 ms |
4300 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 342943881. |