답안 #365122

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
365122 2021-02-10T23:01:51 Z MohamedAhmed04 Money (IZhO17_money) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 1e6 + 10 ;

int arr[MAX] ;
int n ;

set<int>s ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	for(int i = 0 ; i < n ; ++i)
		cin>>arr[i] ;
	int x = -1 , ans = 0 ;
	for(int i = 0 ; i < n ; ++i)
	{
		if(arr[i] < x && arr[i] >= arr[i-1])
			s.insert(arr[i]) ;
		else
		{
			ans++ ;
			if(!s.size() || (*s.rbegin()) < arr[i])
				x = 1e9 ;
			else 
				x = *s.upper_bound(arr[i]) ;
			s.insert(arr[i]) ;
		}
	}
	return cout<<ans<<"\n" , 0 ;
}		
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -