# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
68478 |
2018-08-17T08:04:55 Z |
losmi247 |
Secret (JOI14_secret) |
C++14 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int Q,l,r;
int drvo[2000005];
int n,a[2000005];
void update(int i,int j,int poz,int val,int node){
if(i == j){
drvo[node] = val;
return;
}
int mid = i+(j-i)/2;
if(poz <= mid){
update(i,mid,poz,val,2*node+1);
}
else{
update(mid+1,j,poz,val,2*node+2);
}
drvo[node] = Secret(drvo[2*node+1],drvo[2*node+2]);
}
int get(int i,int j,int l,int r,int node){
if(j < l || i > r){
return 0;
}
if(l <= i && r >= j){
return drvo[node];
}
int mid = i+(j-i)/2;
return Secret(get(i,mid,l,r,2*node+2),get(mid+1,j,l,r,2*node+2));
}
int Query(int L,int R){
return get(0,n-1,L,R,0);
}
void Init(int N,int A[]){
n = N;
for(int i = 0; i < N; i++){
update(0,n-1,i,A[i],0);
a[i] = A[i];
}
cin >> Q;
while(Q--){
cin >> l >> r;
cout << Query(l,r) << endl;
}
}
int main(){
}
Compilation message
/tmp/cciWr4JY.o: In function `main':
secret.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccTh7coN.o:grader-full.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status