답안 #526546

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526546 2022-02-15T07:21:41 Z Mr_Husanboy Money (IZhO17_money) C++14
100 / 100
991 ms 51604 KB
// Muallif: Mansuraliyev Husanboy Murotali o'g'li  >> NamPS
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(a) a.begin(), a.end()
#define F first
#define S second
// 0-9 >> 48-57;    A-Z>>65-90   and   a-z>>97-122 respectively;	

 
 
void solve(){
	int n; cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	 set<int> st;
	st.insert(a[0]); int ans=1;
	int mx=1e9;
	for(int i=1;i<n;i++){
		if(a[i]<a[i-1]||a[i]>mx){
			ans++;
			auto k=st.lower_bound(a[i]+1);
			if(k==st.end()){
				mx=1e9;
			}else mx=*k;
		}
		st.insert(a[i]);
	}
	cout<<ans<<"\n";
}
 
 
int main(){
	ios; 
	//int t=1;   cin>>t; while(t--)
	solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 308 KB Output is correct
20 Correct 1 ms 260 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 308 KB Output is correct
20 Correct 1 ms 260 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 312 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 308 KB Output is correct
20 Correct 1 ms 260 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 312 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 312 KB Output is correct
39 Correct 45 ms 2300 KB Output is correct
40 Correct 99 ms 3516 KB Output is correct
41 Correct 39 ms 1936 KB Output is correct
42 Correct 44 ms 1744 KB Output is correct
43 Correct 26 ms 1356 KB Output is correct
44 Correct 93 ms 4332 KB Output is correct
45 Correct 110 ms 4416 KB Output is correct
46 Correct 131 ms 4324 KB Output is correct
47 Correct 82 ms 4336 KB Output is correct
48 Correct 85 ms 4332 KB Output is correct
49 Correct 450 ms 22812 KB Output is correct
50 Correct 394 ms 22812 KB Output is correct
51 Correct 422 ms 22896 KB Output is correct
52 Correct 427 ms 22776 KB Output is correct
53 Correct 417 ms 22764 KB Output is correct
54 Correct 379 ms 22816 KB Output is correct
55 Correct 965 ms 51300 KB Output is correct
56 Correct 991 ms 51312 KB Output is correct
57 Correct 981 ms 51248 KB Output is correct
58 Correct 968 ms 51228 KB Output is correct
59 Correct 924 ms 51488 KB Output is correct
60 Correct 952 ms 51604 KB Output is correct
61 Correct 909 ms 51380 KB Output is correct
62 Correct 962 ms 51300 KB Output is correct