Submission #85537

# Submission time Handle Problem Language Result Execution time Memory
85537 2018-11-20T19:03:47 Z farukkastamonuda Money (IZhO17_money) C++14
0 / 100
2 ms 380 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(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);
		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 Incorrect 2 ms 380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct
3 Halted 0 ms 0 KB -