# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
88520 |
2018-12-06T09:58:17 Z |
Bodo171 |
Money (IZhO17_money) |
C++14 |
|
2 ms |
744 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 |
2 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 |
2 ms |
652 KB |
Output is correct |
6 |
Correct |
2 ms |
672 KB |
Output is correct |
7 |
Correct |
2 ms |
744 KB |
Output is correct |
8 |
Incorrect |
2 ms |
744 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 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 |
2 ms |
652 KB |
Output is correct |
6 |
Correct |
2 ms |
672 KB |
Output is correct |
7 |
Correct |
2 ms |
744 KB |
Output is correct |
8 |
Incorrect |
2 ms |
744 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 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 |
2 ms |
652 KB |
Output is correct |
6 |
Correct |
2 ms |
672 KB |
Output is correct |
7 |
Correct |
2 ms |
744 KB |
Output is correct |
8 |
Incorrect |
2 ms |
744 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 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 |
2 ms |
652 KB |
Output is correct |
6 |
Correct |
2 ms |
672 KB |
Output is correct |
7 |
Correct |
2 ms |
744 KB |
Output is correct |
8 |
Incorrect |
2 ms |
744 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |