#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(1,N);
}
int Query(int l,int r){
v.clear();
ask(1,n,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++){
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
109 ms |
13396 KB |
Execution killed with signal 11 |
2 |
Runtime error |
106 ms |
12160 KB |
Execution killed with signal 11 |
3 |
Runtime error |
101 ms |
12220 KB |
Execution killed with signal 11 |
4 |
Runtime error |
357 ms |
16740 KB |
Execution killed with signal 11 |
5 |
Runtime error |
354 ms |
16616 KB |
Execution killed with signal 11 |
6 |
Runtime error |
364 ms |
16536 KB |
Execution killed with signal 11 |
7 |
Runtime error |
370 ms |
16524 KB |
Execution killed with signal 11 |
8 |
Runtime error |
368 ms |
16740 KB |
Execution killed with signal 11 |
9 |
Runtime error |
361 ms |
16464 KB |
Execution killed with signal 11 |
10 |
Runtime error |
361 ms |
16576 KB |
Execution killed with signal 11 |