# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
155368 | 2019-09-27T16:48:24 Z | TadijaSebez | Employment (JOI16_employment) | C++11 | 4214 ms | 114628 KB |
#include <bits/stdc++.h> using namespace std; const int N=200050; const int lim=1e9; struct BIT { map<int,int> sum; void init(){ sum.clear();} BIT(){ init();} void Set(int i, int f){ for(;i<=lim;i+=i&-i) sum[i]+=f;} void Set(int l, int r, int f){ if(l<=r) Set(l,f),Set(r+1,-f);} int Get(int i){ int ans=0;for(;i;i-=i&-i) ans+=sum[i];return ans;} } ST; int a[N]; void Add(int i, int f) { ST.Set(a[i+1]+1,a[i],f); } int main() { int n,m; scanf("%i %i",&n,&m); for(int i=1;i<=n;i++) scanf("%i",&a[i]); for(int i=1;i<=n;i++) Add(i,1); while(m--) { int t,b,c,d; scanf("%i",&t); if(t==1) scanf("%i",&b),printf("%i\n",ST.Get(b)); else { scanf("%i %i",&c,&d); if(c!=1) Add(c-1,-1); Add(c,-1); a[c]=d; if(c!=1) Add(c-1,1); Add(c,1); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 128 KB | Output is correct |
4 | Correct | 9 ms | 1144 KB | Output is correct |
5 | Correct | 5 ms | 760 KB | Output is correct |
6 | Correct | 6 ms | 888 KB | Output is correct |
7 | Correct | 13 ms | 1528 KB | Output is correct |
8 | Correct | 12 ms | 1400 KB | Output is correct |
9 | Correct | 14 ms | 1656 KB | Output is correct |
10 | Correct | 19 ms | 2040 KB | Output is correct |
11 | Correct | 18 ms | 1912 KB | Output is correct |
12 | Correct | 20 ms | 2168 KB | Output is correct |
13 | Correct | 20 ms | 2168 KB | Output is correct |
14 | Correct | 19 ms | 2044 KB | Output is correct |
15 | Correct | 19 ms | 2040 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Correct | 8 ms | 632 KB | Output is correct |
3 | Correct | 17 ms | 2296 KB | Output is correct |
4 | Correct | 142 ms | 12000 KB | Output is correct |
5 | Correct | 316 ms | 21852 KB | Output is correct |
6 | Correct | 517 ms | 32436 KB | Output is correct |
7 | Correct | 823 ms | 47460 KB | Output is correct |
8 | Correct | 1098 ms | 58116 KB | Output is correct |
9 | Correct | 2037 ms | 91276 KB | Output is correct |
10 | Correct | 1838 ms | 84064 KB | Output is correct |
11 | Correct | 2394 ms | 101740 KB | Output is correct |
12 | Correct | 2740 ms | 112768 KB | Output is correct |
13 | Correct | 2998 ms | 113000 KB | Output is correct |
14 | Correct | 2586 ms | 111504 KB | Output is correct |
15 | Correct | 2651 ms | 110532 KB | Output is correct |
16 | Correct | 2720 ms | 114576 KB | Output is correct |
17 | Correct | 2688 ms | 114592 KB | Output is correct |
18 | Correct | 2686 ms | 114628 KB | Output is correct |
19 | Correct | 2876 ms | 114528 KB | Output is correct |
20 | Correct | 2743 ms | 113188 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 128 KB | Output is correct |
4 | Correct | 9 ms | 1144 KB | Output is correct |
5 | Correct | 5 ms | 760 KB | Output is correct |
6 | Correct | 6 ms | 888 KB | Output is correct |
7 | Correct | 13 ms | 1528 KB | Output is correct |
8 | Correct | 12 ms | 1400 KB | Output is correct |
9 | Correct | 14 ms | 1656 KB | Output is correct |
10 | Correct | 19 ms | 2040 KB | Output is correct |
11 | Correct | 18 ms | 1912 KB | Output is correct |
12 | Correct | 20 ms | 2168 KB | Output is correct |
13 | Correct | 20 ms | 2168 KB | Output is correct |
14 | Correct | 19 ms | 2044 KB | Output is correct |
15 | Correct | 19 ms | 2040 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 8 ms | 632 KB | Output is correct |
18 | Correct | 17 ms | 2296 KB | Output is correct |
19 | Correct | 142 ms | 12000 KB | Output is correct |
20 | Correct | 316 ms | 21852 KB | Output is correct |
21 | Correct | 517 ms | 32436 KB | Output is correct |
22 | Correct | 823 ms | 47460 KB | Output is correct |
23 | Correct | 1098 ms | 58116 KB | Output is correct |
24 | Correct | 2037 ms | 91276 KB | Output is correct |
25 | Correct | 1838 ms | 84064 KB | Output is correct |
26 | Correct | 2394 ms | 101740 KB | Output is correct |
27 | Correct | 2740 ms | 112768 KB | Output is correct |
28 | Correct | 2998 ms | 113000 KB | Output is correct |
29 | Correct | 2586 ms | 111504 KB | Output is correct |
30 | Correct | 2651 ms | 110532 KB | Output is correct |
31 | Correct | 2720 ms | 114576 KB | Output is correct |
32 | Correct | 2688 ms | 114592 KB | Output is correct |
33 | Correct | 2686 ms | 114628 KB | Output is correct |
34 | Correct | 2876 ms | 114528 KB | Output is correct |
35 | Correct | 2743 ms | 113188 KB | Output is correct |
36 | Correct | 5 ms | 376 KB | Output is correct |
37 | Correct | 10 ms | 632 KB | Output is correct |
38 | Correct | 25 ms | 2552 KB | Output is correct |
39 | Correct | 191 ms | 11980 KB | Output is correct |
40 | Correct | 392 ms | 19708 KB | Output is correct |
41 | Correct | 813 ms | 31760 KB | Output is correct |
42 | Correct | 1228 ms | 43908 KB | Output is correct |
43 | Correct | 1607 ms | 56180 KB | Output is correct |
44 | Correct | 3243 ms | 96616 KB | Output is correct |
45 | Correct | 2512 ms | 80424 KB | Output is correct |
46 | Correct | 2798 ms | 87032 KB | Output is correct |
47 | Correct | 3852 ms | 110960 KB | Output is correct |
48 | Correct | 4128 ms | 112212 KB | Output is correct |
49 | Correct | 4038 ms | 112176 KB | Output is correct |
50 | Correct | 4114 ms | 109336 KB | Output is correct |
51 | Correct | 4081 ms | 113644 KB | Output is correct |
52 | Correct | 4006 ms | 113732 KB | Output is correct |
53 | Correct | 4214 ms | 113840 KB | Output is correct |
54 | Correct | 4131 ms | 113768 KB | Output is correct |
55 | Correct | 4003 ms | 112304 KB | Output is correct |