# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25128 | 2017-06-20T07:29:32 Z | 시제연(#1054) | Sterilizing Spray (JOI15_sterilizing) | C++ | 63 ms | 3464 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, q, k; int arr[100100]; int tree[270000]; int key = 131072; void upd(int idx, int val) { idx+=key; tree[idx] = val; idx>>=1; while(idx>0) { tree[idx] = tree[idx*2]+tree[idx*2+1]; idx>>=1; } } ll getv(int s, int e) { ll res = 0; s+=key; e+=key; while(s<=e) { if (s&1) res += tree[s++]; if (~e&1) res += tree[e--]; s>>=1;e>>=1; } return res; } void solve1() { int i; for (i=0;i<n;i++) upd(i,arr[i]); for (i=0;i<q;i++) { int a, b, c; scanf("%d%d%d",&a,&b,&c); if (a==1) upd(b-1,c); else if (a==3) printf("%lld\n",getv(b-1,c-1)); } } void solve() { } int main() { int i; scanf("%d%d%d",&n,&q,&k); for (i=0;i<n;i++) scanf("%d",&arr[i]); if (k==1) solve1(); else solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 63 ms | 3464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 3464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |