Submission #85538

# Submission time Handle Problem Language Result Execution time Memory
85538 2018-11-20T19:08:07 Z farukkastamonuda Money (IZhO17_money) C++14
100 / 100
1423 ms 78748 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 1000005
using namespace std;
lo int n,A[li],flag,tut=1,cev;
set<lo int> s;
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&A[i]);
	s.insert(inf);
	//s.insert(0);
	//~ s.insert(A[1]);
	//~ for(int i=2;i<=n;i++){
		//~ if(A[i]>=A[i-1]){
			//~ s.insert(A[i]);
			//~ tut=i;
		//~ }
		//~ else break;
	//~ }
	//~ lo int bas=1;
	//if(bas<=n) cev++;
	for(int i=1;i<=n;i++){
		//~ printf("I :: %d CEV :: %d\n",i,cev);
		cev++;
		s.insert(A[i]);
		auto it=s.upper_bound(A[i]);
		while(i<n && A[i+1]>=A[i] && A[i+1]<=*it){
			i++;
			s.insert(A[i]);
		}
	}
	printf("%lld\n",cev);
	return 0;
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
money.cpp:15:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%lld",&A[i]);
                        ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 3 ms 400 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 624 KB Output is correct
10 Correct 2 ms 624 KB Output is correct
11 Correct 2 ms 624 KB Output is correct
12 Correct 2 ms 624 KB Output is correct
13 Correct 2 ms 624 KB Output is correct
14 Correct 2 ms 624 KB Output is correct
15 Correct 2 ms 636 KB Output is correct
16 Correct 2 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 3 ms 400 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 624 KB Output is correct
10 Correct 2 ms 624 KB Output is correct
11 Correct 2 ms 624 KB Output is correct
12 Correct 2 ms 624 KB Output is correct
13 Correct 2 ms 624 KB Output is correct
14 Correct 2 ms 624 KB Output is correct
15 Correct 2 ms 636 KB Output is correct
16 Correct 2 ms 636 KB Output is correct
17 Correct 2 ms 636 KB Output is correct
18 Correct 2 ms 636 KB Output is correct
19 Correct 2 ms 636 KB Output is correct
20 Correct 2 ms 636 KB Output is correct
21 Correct 2 ms 636 KB Output is correct
22 Correct 2 ms 636 KB Output is correct
23 Correct 2 ms 636 KB Output is correct
24 Correct 2 ms 636 KB Output is correct
25 Correct 2 ms 636 KB Output is correct
26 Correct 2 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 3 ms 400 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 624 KB Output is correct
10 Correct 2 ms 624 KB Output is correct
11 Correct 2 ms 624 KB Output is correct
12 Correct 2 ms 624 KB Output is correct
13 Correct 2 ms 624 KB Output is correct
14 Correct 2 ms 624 KB Output is correct
15 Correct 2 ms 636 KB Output is correct
16 Correct 2 ms 636 KB Output is correct
17 Correct 2 ms 636 KB Output is correct
18 Correct 2 ms 636 KB Output is correct
19 Correct 2 ms 636 KB Output is correct
20 Correct 2 ms 636 KB Output is correct
21 Correct 2 ms 636 KB Output is correct
22 Correct 2 ms 636 KB Output is correct
23 Correct 2 ms 636 KB Output is correct
24 Correct 2 ms 636 KB Output is correct
25 Correct 2 ms 636 KB Output is correct
26 Correct 2 ms 636 KB Output is correct
27 Correct 2 ms 636 KB Output is correct
28 Correct 2 ms 636 KB Output is correct
29 Correct 2 ms 636 KB Output is correct
30 Correct 2 ms 640 KB Output is correct
31 Correct 2 ms 644 KB Output is correct
32 Correct 2 ms 648 KB Output is correct
33 Correct 2 ms 648 KB Output is correct
34 Correct 3 ms 656 KB Output is correct
35 Correct 2 ms 660 KB Output is correct
36 Correct 2 ms 664 KB Output is correct
37 Correct 2 ms 668 KB Output is correct
38 Correct 2 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 3 ms 400 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 2 ms 624 KB Output is correct
10 Correct 2 ms 624 KB Output is correct
11 Correct 2 ms 624 KB Output is correct
12 Correct 2 ms 624 KB Output is correct
13 Correct 2 ms 624 KB Output is correct
14 Correct 2 ms 624 KB Output is correct
15 Correct 2 ms 636 KB Output is correct
16 Correct 2 ms 636 KB Output is correct
17 Correct 2 ms 636 KB Output is correct
18 Correct 2 ms 636 KB Output is correct
19 Correct 2 ms 636 KB Output is correct
20 Correct 2 ms 636 KB Output is correct
21 Correct 2 ms 636 KB Output is correct
22 Correct 2 ms 636 KB Output is correct
23 Correct 2 ms 636 KB Output is correct
24 Correct 2 ms 636 KB Output is correct
25 Correct 2 ms 636 KB Output is correct
26 Correct 2 ms 636 KB Output is correct
27 Correct 2 ms 636 KB Output is correct
28 Correct 2 ms 636 KB Output is correct
29 Correct 2 ms 636 KB Output is correct
30 Correct 2 ms 640 KB Output is correct
31 Correct 2 ms 644 KB Output is correct
32 Correct 2 ms 648 KB Output is correct
33 Correct 2 ms 648 KB Output is correct
34 Correct 3 ms 656 KB Output is correct
35 Correct 2 ms 660 KB Output is correct
36 Correct 2 ms 664 KB Output is correct
37 Correct 2 ms 668 KB Output is correct
38 Correct 2 ms 672 KB Output is correct
39 Correct 93 ms 7604 KB Output is correct
40 Correct 160 ms 11608 KB Output is correct
41 Correct 108 ms 11608 KB Output is correct
42 Correct 79 ms 11608 KB Output is correct
43 Correct 49 ms 11608 KB Output is correct
44 Correct 195 ms 13224 KB Output is correct
45 Correct 186 ms 13288 KB Output is correct
46 Correct 187 ms 13288 KB Output is correct
47 Correct 173 ms 13544 KB Output is correct
48 Correct 179 ms 20376 KB Output is correct
49 Correct 651 ms 45820 KB Output is correct
50 Correct 666 ms 49948 KB Output is correct
51 Correct 624 ms 49960 KB Output is correct
52 Correct 654 ms 50100 KB Output is correct
53 Correct 618 ms 50100 KB Output is correct
54 Correct 636 ms 50200 KB Output is correct
55 Correct 1403 ms 78564 KB Output is correct
56 Correct 1423 ms 78564 KB Output is correct
57 Correct 1388 ms 78748 KB Output is correct
58 Correct 1402 ms 78748 KB Output is correct
59 Correct 1369 ms 78748 KB Output is correct
60 Correct 1326 ms 78748 KB Output is correct
61 Correct 1357 ms 78748 KB Output is correct
62 Correct 1324 ms 78748 KB Output is correct