# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
88558 |
2018-12-06T13:29:20 Z |
Bodo171 |
Money (IZhO17_money) |
C++14 |
|
205 ms |
35440 KB |
#include <iostream>
#include <fstream>
using namespace std;
const int lim=1000*1000;
const int nmax=1000*1000+5;
int aib[nmax],a[nmax];
int n,i,j,secv,k;
inline int lbit(int x)
{
return ((x^(x-1))&x);
}
void update(int poz,int val)
{
for(int idx=poz;idx<=lim;idx+=lbit(idx))
aib[idx]+=val;
}
int compute(int poz)
{
int ret=0;
for(int idx=poz;idx>0;idx-=lbit(idx))
ret+=aib[idx];
return ret;
}
int main()
{
//freopen("data.in","r",stdin);
ios_base::sync_with_stdio(false);
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a[i];
}
for(i=1;i<=n;i++)
{
j=i;
while(j<n&&a[j]<=a[j+1]&&compute(a[j+1]-1)-compute(a[i])<=0)
j++;
secv++;
for(k=i;k<=j;k++)
update(a[k],1);
i=j;
}
cout<<secv;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
500 KB |
Output is correct |
4 |
Correct |
2 ms |
576 KB |
Output is correct |
5 |
Correct |
1 ms |
576 KB |
Output is correct |
6 |
Correct |
2 ms |
588 KB |
Output is correct |
7 |
Correct |
2 ms |
740 KB |
Output is correct |
8 |
Correct |
2 ms |
740 KB |
Output is correct |
9 |
Correct |
2 ms |
740 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
2 ms |
740 KB |
Output is correct |
12 |
Correct |
2 ms |
740 KB |
Output is correct |
13 |
Correct |
2 ms |
740 KB |
Output is correct |
14 |
Correct |
2 ms |
740 KB |
Output is correct |
15 |
Correct |
2 ms |
756 KB |
Output is correct |
16 |
Correct |
2 ms |
764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
500 KB |
Output is correct |
4 |
Correct |
2 ms |
576 KB |
Output is correct |
5 |
Correct |
1 ms |
576 KB |
Output is correct |
6 |
Correct |
2 ms |
588 KB |
Output is correct |
7 |
Correct |
2 ms |
740 KB |
Output is correct |
8 |
Correct |
2 ms |
740 KB |
Output is correct |
9 |
Correct |
2 ms |
740 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
2 ms |
740 KB |
Output is correct |
12 |
Correct |
2 ms |
740 KB |
Output is correct |
13 |
Correct |
2 ms |
740 KB |
Output is correct |
14 |
Correct |
2 ms |
740 KB |
Output is correct |
15 |
Correct |
2 ms |
756 KB |
Output is correct |
16 |
Correct |
2 ms |
764 KB |
Output is correct |
17 |
Correct |
2 ms |
764 KB |
Output is correct |
18 |
Correct |
2 ms |
768 KB |
Output is correct |
19 |
Correct |
2 ms |
772 KB |
Output is correct |
20 |
Correct |
2 ms |
772 KB |
Output is correct |
21 |
Correct |
2 ms |
836 KB |
Output is correct |
22 |
Correct |
2 ms |
836 KB |
Output is correct |
23 |
Correct |
2 ms |
836 KB |
Output is correct |
24 |
Correct |
2 ms |
836 KB |
Output is correct |
25 |
Correct |
2 ms |
836 KB |
Output is correct |
26 |
Correct |
2 ms |
840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
500 KB |
Output is correct |
4 |
Correct |
2 ms |
576 KB |
Output is correct |
5 |
Correct |
1 ms |
576 KB |
Output is correct |
6 |
Correct |
2 ms |
588 KB |
Output is correct |
7 |
Correct |
2 ms |
740 KB |
Output is correct |
8 |
Correct |
2 ms |
740 KB |
Output is correct |
9 |
Correct |
2 ms |
740 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
2 ms |
740 KB |
Output is correct |
12 |
Correct |
2 ms |
740 KB |
Output is correct |
13 |
Correct |
2 ms |
740 KB |
Output is correct |
14 |
Correct |
2 ms |
740 KB |
Output is correct |
15 |
Correct |
2 ms |
756 KB |
Output is correct |
16 |
Correct |
2 ms |
764 KB |
Output is correct |
17 |
Correct |
2 ms |
764 KB |
Output is correct |
18 |
Correct |
2 ms |
768 KB |
Output is correct |
19 |
Correct |
2 ms |
772 KB |
Output is correct |
20 |
Correct |
2 ms |
772 KB |
Output is correct |
21 |
Correct |
2 ms |
836 KB |
Output is correct |
22 |
Correct |
2 ms |
836 KB |
Output is correct |
23 |
Correct |
2 ms |
836 KB |
Output is correct |
24 |
Correct |
2 ms |
836 KB |
Output is correct |
25 |
Correct |
2 ms |
836 KB |
Output is correct |
26 |
Correct |
2 ms |
840 KB |
Output is correct |
27 |
Correct |
2 ms |
840 KB |
Output is correct |
28 |
Correct |
2 ms |
840 KB |
Output is correct |
29 |
Correct |
2 ms |
840 KB |
Output is correct |
30 |
Correct |
2 ms |
840 KB |
Output is correct |
31 |
Correct |
2 ms |
840 KB |
Output is correct |
32 |
Correct |
2 ms |
864 KB |
Output is correct |
33 |
Correct |
2 ms |
868 KB |
Output is correct |
34 |
Correct |
2 ms |
872 KB |
Output is correct |
35 |
Correct |
2 ms |
872 KB |
Output is correct |
36 |
Correct |
3 ms |
872 KB |
Output is correct |
37 |
Correct |
3 ms |
2036 KB |
Output is correct |
38 |
Correct |
4 ms |
2168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
500 KB |
Output is correct |
4 |
Correct |
2 ms |
576 KB |
Output is correct |
5 |
Correct |
1 ms |
576 KB |
Output is correct |
6 |
Correct |
2 ms |
588 KB |
Output is correct |
7 |
Correct |
2 ms |
740 KB |
Output is correct |
8 |
Correct |
2 ms |
740 KB |
Output is correct |
9 |
Correct |
2 ms |
740 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
2 ms |
740 KB |
Output is correct |
12 |
Correct |
2 ms |
740 KB |
Output is correct |
13 |
Correct |
2 ms |
740 KB |
Output is correct |
14 |
Correct |
2 ms |
740 KB |
Output is correct |
15 |
Correct |
2 ms |
756 KB |
Output is correct |
16 |
Correct |
2 ms |
764 KB |
Output is correct |
17 |
Correct |
2 ms |
764 KB |
Output is correct |
18 |
Correct |
2 ms |
768 KB |
Output is correct |
19 |
Correct |
2 ms |
772 KB |
Output is correct |
20 |
Correct |
2 ms |
772 KB |
Output is correct |
21 |
Correct |
2 ms |
836 KB |
Output is correct |
22 |
Correct |
2 ms |
836 KB |
Output is correct |
23 |
Correct |
2 ms |
836 KB |
Output is correct |
24 |
Correct |
2 ms |
836 KB |
Output is correct |
25 |
Correct |
2 ms |
836 KB |
Output is correct |
26 |
Correct |
2 ms |
840 KB |
Output is correct |
27 |
Correct |
2 ms |
840 KB |
Output is correct |
28 |
Correct |
2 ms |
840 KB |
Output is correct |
29 |
Correct |
2 ms |
840 KB |
Output is correct |
30 |
Correct |
2 ms |
840 KB |
Output is correct |
31 |
Correct |
2 ms |
840 KB |
Output is correct |
32 |
Correct |
2 ms |
864 KB |
Output is correct |
33 |
Correct |
2 ms |
868 KB |
Output is correct |
34 |
Correct |
2 ms |
872 KB |
Output is correct |
35 |
Correct |
2 ms |
872 KB |
Output is correct |
36 |
Correct |
3 ms |
872 KB |
Output is correct |
37 |
Correct |
3 ms |
2036 KB |
Output is correct |
38 |
Correct |
4 ms |
2168 KB |
Output is correct |
39 |
Correct |
82 ms |
5948 KB |
Output is correct |
40 |
Correct |
138 ms |
12524 KB |
Output is correct |
41 |
Correct |
71 ms |
13372 KB |
Output is correct |
42 |
Correct |
63 ms |
15708 KB |
Output is correct |
43 |
Correct |
45 ms |
16984 KB |
Output is correct |
44 |
Correct |
172 ms |
26596 KB |
Output is correct |
45 |
Correct |
167 ms |
31632 KB |
Output is correct |
46 |
Correct |
169 ms |
31632 KB |
Output is correct |
47 |
Correct |
152 ms |
31632 KB |
Output is correct |
48 |
Correct |
162 ms |
31632 KB |
Output is correct |
49 |
Correct |
179 ms |
35288 KB |
Output is correct |
50 |
Correct |
184 ms |
35308 KB |
Output is correct |
51 |
Correct |
183 ms |
35308 KB |
Output is correct |
52 |
Correct |
179 ms |
35376 KB |
Output is correct |
53 |
Correct |
187 ms |
35376 KB |
Output is correct |
54 |
Correct |
186 ms |
35376 KB |
Output is correct |
55 |
Correct |
205 ms |
35436 KB |
Output is correct |
56 |
Correct |
199 ms |
35436 KB |
Output is correct |
57 |
Correct |
202 ms |
35436 KB |
Output is correct |
58 |
Correct |
197 ms |
35436 KB |
Output is correct |
59 |
Correct |
198 ms |
35436 KB |
Output is correct |
60 |
Correct |
199 ms |
35436 KB |
Output is correct |
61 |
Correct |
202 ms |
35436 KB |
Output is correct |
62 |
Correct |
202 ms |
35440 KB |
Output is correct |