답안 #169209

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169209 2019-12-19T04:42:29 Z Trickster Money (IZhO17_money) C++14
0 / 100
2 ms 404 KB
//Suleyman Atayew

#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>

#define N 1000010
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define inf 1000000007
#define pii pair <ll, ll>

using namespace std;

ll n;
ll v[N];
set <ll> S;

int main()
{
	cin >> n;
	
	ll ans = 0;
	S.insert(1e9);
	for(ll i = 1; i <= n; i++)
		cin >> v[i];
	
	for(ll i = 1; i <= n; i++) {
		ll h = i+1;
		ll y = *S.lower_bound(v[i]);
		
		while(h <= n) {
			ll x = *S.lower_bound(v[h]);
			
			if(x != y || v[h] < v[h-1]) break;
			
			h++;
		}
		
		for(ll j = i; j < h; j++) S.insert(v[j]);
		
		ans ++;
		i = h-1;
	}
	
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 404 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 404 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 404 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 404 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -