Submission #36707

# Submission time Handle Problem Language Result Execution time Memory
36707 2017-12-13T10:34:15 Z Tenuun Money (IZhO17_money) C++14
0 / 100
0 ms 9828 KB
#include <bits/stdc++.h>

using namespace std;

long long fen[1000001], n;

void update(int pos, int val){
	for(int i=pos; i<=n; i+= i&-i)
		fen[i]+=val;
}

int sum(int pos){
	long long ans=0;
	for(int i=pos; i>0; i-= i&-i)
		ans+=fen[i];
	return ans;
}

int main(){
	int i, res, last, curr; 
	cin >> n;
	int a[n];
	for(i=1; i<=n; i++)
		cin >> a[i];
	update(2, a[1]);   
	res=1;
	last=a[1];
	for(i=2; i<=n; i++){
		curr=a[i];
		if(curr<last || (sum(curr)-sum(last+1)>0)) res++;
		update(i+1, 1);
		last=curr;	
	}
	cout << res;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9828 KB Output is correct
2 Correct 0 ms 9828 KB Output is correct
3 Correct 0 ms 9828 KB Output is correct
4 Correct 0 ms 9828 KB Output is correct
5 Correct 0 ms 9828 KB Output is correct
6 Correct 0 ms 9828 KB Output is correct
7 Correct 0 ms 9828 KB Output is correct
8 Correct 0 ms 9828 KB Output is correct
9 Correct 0 ms 9828 KB Output is correct
10 Incorrect 0 ms 9828 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9828 KB Output is correct
2 Correct 0 ms 9828 KB Output is correct
3 Correct 0 ms 9828 KB Output is correct
4 Correct 0 ms 9828 KB Output is correct
5 Correct 0 ms 9828 KB Output is correct
6 Correct 0 ms 9828 KB Output is correct
7 Correct 0 ms 9828 KB Output is correct
8 Correct 0 ms 9828 KB Output is correct
9 Correct 0 ms 9828 KB Output is correct
10 Incorrect 0 ms 9828 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9828 KB Output is correct
2 Correct 0 ms 9828 KB Output is correct
3 Correct 0 ms 9828 KB Output is correct
4 Correct 0 ms 9828 KB Output is correct
5 Correct 0 ms 9828 KB Output is correct
6 Correct 0 ms 9828 KB Output is correct
7 Correct 0 ms 9828 KB Output is correct
8 Correct 0 ms 9828 KB Output is correct
9 Correct 0 ms 9828 KB Output is correct
10 Incorrect 0 ms 9828 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9828 KB Output is correct
2 Correct 0 ms 9828 KB Output is correct
3 Correct 0 ms 9828 KB Output is correct
4 Correct 0 ms 9828 KB Output is correct
5 Correct 0 ms 9828 KB Output is correct
6 Correct 0 ms 9828 KB Output is correct
7 Correct 0 ms 9828 KB Output is correct
8 Correct 0 ms 9828 KB Output is correct
9 Correct 0 ms 9828 KB Output is correct
10 Incorrect 0 ms 9828 KB Output isn't correct
11 Halted 0 ms 0 KB -