# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
959502 |
2024-04-08T10:33:47 Z |
irmuun |
Secret (JOI14_secret) |
C++17 |
|
374 ms |
8532 KB |
#include<bits/stdc++.h>
#include "secret.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
int n;
vector<pair<int,int>>v;
int val[1005][1005];
void build(int l,int r){
val[l][r]=Secret(l,r);
if(l==r) return;
int mid=(l+r)/2;
build(l,mid);
build(mid+1,r);
}
void ask(int l,int r,int L,int R){
if(l>r||R<l||r<L) return;
if(L<=l&&r<=R){
v.pb({l,r});
return;
}
int mid=(l+r)/2;
ask(l,mid,L,R);
ask(mid+1,r,L,R);
}
void Init(int N,int A[]){
n=N;
build(0,n-1);
}
int Query(int l,int r){
v.clear();
ask(0,n-1,l,r);
int ans=val[v[0].ff][v[0].ss];
for(int i=1;i<v.size();i++){
ans=Secret(ans,val[v[i].ff][v[i].ss]);
}
return ans;
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:41:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for(int i=1;i<v.size();i++){
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
94 ms |
6112 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 324301593. |
2 |
Incorrect |
94 ms |
6016 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 16851008. |
3 |
Incorrect |
94 ms |
4452 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 898027796. |
4 |
Incorrect |
353 ms |
8196 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 85181070. |
5 |
Incorrect |
352 ms |
8308 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 812273152. |
6 |
Incorrect |
348 ms |
8532 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 941744377. |
7 |
Incorrect |
357 ms |
8448 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 712028164. |
8 |
Incorrect |
358 ms |
8108 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 604382024. |
9 |
Incorrect |
374 ms |
8180 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 139211054. |
10 |
Incorrect |
353 ms |
8156 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 875372684. |