# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20584 | kdh9949 | 역사적 조사 (JOI14_historical) | C++14 | 2966 ms | 6804 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 131072, b = 320;
int n, q, a[100010], xx[100010];
ll ans[100010];
struct Query{
int s, e, idx;
bool operator<(const Query &oth) const {
return (s / b == oth.s / b) ? e < oth.e : s < oth.s;
}
} qa[100010];
struct Seg{
ll dat[2 * sz];
void init(){
for(int i = 1; i < 2 * sz; i++) dat[i] = 0;
}
void upd(int x, int v){
x += sz - 1; dat[x] += v * xx[x - sz + 1];
for(x /= 2; x; x /= 2) dat[x] = max(dat[2 * x], dat[2 * x + 1]);
}
ll get(){ return dat[1]; }
} S;
int main(){
scanf("%d%d", &n, &q);
for(int i = 1; i <= n; i++){ scanf("%d", a + i); xx[i] = a[i]; }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |