Submission #91092

# Submission time Handle Problem Language Result Execution time Memory
91092 2018-12-26T08:38:33 Z emil_physmath Money (IZhO17_money) C++14
0 / 100
2 ms 592 KB
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <set>
using namespace std;

int a[1000005];

int main()
{
	int n;
	cin>>n;
	for (int k=0; k<n; k++)
		scanf("%d", a+k);
	int i=0, ans=0;
	multiset<int> curSorted;
	while (i<n)
	{
		ans++;
		int j=i;
		while (j+1<n && a[j+1]>a[j])
			j++;
		auto it=curSorted.upper_bound(a[i]);
		if (it!=curSorted.end())
			j=upper_bound(a+i, a+j+1, *it)-a-1;
		for (int k=i; k<=j; k++)
			curSorted.insert(a[k]);
		i=j+1;
	}
	cout<<ans<<'\n';

	char I;
	cin >> I;
	return 0;
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", a+k);
   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 568 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Incorrect 2 ms 592 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 568 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Incorrect 2 ms 592 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 568 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Incorrect 2 ms 592 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 568 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Incorrect 2 ms 592 KB Output isn't correct
8 Halted 0 ms 0 KB -