# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77969 | 2018-10-01T14:05:46 Z | nxteru | Sterilizing Spray (JOI15_sterilizing) | C++14 | 139 ms | 30560 KB |
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <cstdio> #include <cstring> #include <string> #include <math.h> using namespace std; typedef long long ll; typedef double D; typedef pair<int,int> P; #define M 1000000007 #define F first #define S second #define PB push_back #define INF 100000000000000000 ll n,q,k,seg[1<<18]; void up(int a,ll x){ a+=(1<<17)-1; seg[a]=x; while(a>0){ a=(a-1)/2; seg[a]=seg[a*2+1]+seg[a*2+2]; } } ll sum(int a,int b,int l,int r,int o){ if(r<a||b<l)return 0; if(a<=l&&r<=b)return seg[o]; return sum(a,b,l,(l+r-1)/2,o*2+1)+sum(a,b,(l+r+1)/2,r,o*2+2); } int main(void){ scanf("%lld%lld%lld",&n,&q,&k); for(int i=0;i<n;i++){ ll a; scanf("%lld",&a); up(i,a); } while(q){ ll s,a,b; scanf("%lld%lld%lld",&s,&a,&b); if(s==1){ up(a-1,b); } if(s==3){ printf("%lld\n",sum(a-1,b-1,0,(1<<17)-1,0)); } q--; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 77 ms | 3632 KB | Output is correct |
2 | Correct | 67 ms | 5172 KB | Output is correct |
3 | Correct | 63 ms | 7436 KB | Output is correct |
4 | Correct | 72 ms | 10016 KB | Output is correct |
5 | Correct | 98 ms | 12576 KB | Output is correct |
6 | Correct | 89 ms | 15068 KB | Output is correct |
7 | Correct | 96 ms | 17532 KB | Output is correct |
8 | Correct | 139 ms | 20052 KB | Output is correct |
9 | Correct | 83 ms | 22400 KB | Output is correct |
10 | Correct | 84 ms | 24684 KB | Output is correct |
11 | Correct | 81 ms | 26988 KB | Output is correct |
12 | Correct | 84 ms | 29288 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 29288 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 30560 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |