Submission #85535

# Submission time Handle Problem Language Result Execution time Memory
85535 2018-11-20T18:57:29 Z farukkastamonuda Money (IZhO17_money) C++14
25 / 100
2 ms 736 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=1;
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(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=tut+1;
	if(bas<=n) cev++;
	for(int i=tut+1;i<=n;i++){
		//~ printf("I :: %d CEV :: %d\n",i,cev);
		if(i==bas || A[i]>=A[i-1]){
			lo int it1=*s.upper_bound(A[bas]);
			//int it2=*s.upper_bound(A[bas]);
			//~ cout<<"YETETETETETETETETERRRETETE::: :: "<<it1<<"   "<<it2<<endl; 
			if(it1>=A[i]) {s.insert(A[i]);}
			else{
				//~ cout<<"EASAS :: : : "<<i<<endl;
				cev++;
				bas=i;
				i--;
			}
		}
		else{
			bas=i;
			cev++;
			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 2 ms 376 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 552 KB Output is correct
9 Correct 2 ms 552 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 2 ms 552 KB Output is correct
15 Correct 2 ms 552 KB Output is correct
16 Correct 2 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 552 KB Output is correct
9 Correct 2 ms 552 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 2 ms 552 KB Output is correct
15 Correct 2 ms 552 KB Output is correct
16 Correct 2 ms 564 KB Output is correct
17 Correct 2 ms 564 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 720 KB Output is correct
24 Correct 2 ms 720 KB Output is correct
25 Correct 2 ms 736 KB Output is correct
26 Correct 2 ms 736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 552 KB Output is correct
9 Correct 2 ms 552 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 2 ms 552 KB Output is correct
15 Correct 2 ms 552 KB Output is correct
16 Correct 2 ms 564 KB Output is correct
17 Correct 2 ms 564 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 720 KB Output is correct
24 Correct 2 ms 720 KB Output is correct
25 Correct 2 ms 736 KB Output is correct
26 Correct 2 ms 736 KB Output is correct
27 Correct 2 ms 736 KB Output is correct
28 Incorrect 2 ms 736 KB Output isn't correct
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 552 KB Output is correct
9 Correct 2 ms 552 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 2 ms 552 KB Output is correct
15 Correct 2 ms 552 KB Output is correct
16 Correct 2 ms 564 KB Output is correct
17 Correct 2 ms 564 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 720 KB Output is correct
24 Correct 2 ms 720 KB Output is correct
25 Correct 2 ms 736 KB Output is correct
26 Correct 2 ms 736 KB Output is correct
27 Correct 2 ms 736 KB Output is correct
28 Incorrect 2 ms 736 KB Output isn't correct
29 Halted 0 ms 0 KB -