답안 #531724

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
531724 2022-03-01T10:36:38 Z kebine Money (IZhO17_money) C++17
100 / 100
1177 ms 58068 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll mod = 1e9 + 7;
#pragma GCC optimize("Ofast")
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define sc second
#define endl '\n'
#define gl ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
  int n, id = 1, ans = 1, akhir = INT_MAX;
  cin >> n;
  
  vi a(n);
  set<int> st;
  
  for(int i = 0; i < n; i++) cin >> a[i];
  st.insert(a[0]);
  
  while(a[id] >= a[id - 1]  and id < n){
    st.insert(a[id]);
    id++;
  }
  
  while(id < n){
    if(a[id] < a[id - 1] or a[id] > akhir){
      ans++;
      auto it = st.ub(a[id]);
      if(it != st.end()) akhir = *it;
      else akhir = INT_MAX;
    }
    st.insert(a[id]);
    id++;
  }
  
  cout << ans << endl;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 288 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 1 ms 204 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 288 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 224 KB Output is correct
19 Correct 1 ms 288 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 292 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 1 ms 292 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 1 ms 204 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 288 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 224 KB Output is correct
19 Correct 1 ms 288 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 292 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 1 ms 292 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 288 KB Output is correct
37 Correct 1 ms 292 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 288 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 288 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 224 KB Output is correct
19 Correct 1 ms 288 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 292 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 1 ms 292 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 288 KB Output is correct
37 Correct 1 ms 292 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 141 ms 5344 KB Output is correct
40 Correct 254 ms 8644 KB Output is correct
41 Correct 124 ms 4364 KB Output is correct
42 Correct 108 ms 3908 KB Output is correct
43 Correct 78 ms 2876 KB Output is correct
44 Correct 326 ms 10840 KB Output is correct
45 Correct 293 ms 10820 KB Output is correct
46 Correct 310 ms 10964 KB Output is correct
47 Correct 294 ms 10960 KB Output is correct
48 Correct 299 ms 10984 KB Output is correct
49 Correct 582 ms 29368 KB Output is correct
50 Correct 576 ms 29428 KB Output is correct
51 Correct 585 ms 29396 KB Output is correct
52 Correct 596 ms 29596 KB Output is correct
53 Correct 587 ms 29396 KB Output is correct
54 Correct 592 ms 29252 KB Output is correct
55 Correct 1099 ms 57812 KB Output is correct
56 Correct 1102 ms 58068 KB Output is correct
57 Correct 1094 ms 57980 KB Output is correct
58 Correct 1094 ms 57916 KB Output is correct
59 Correct 1133 ms 57812 KB Output is correct
60 Correct 1077 ms 57888 KB Output is correct
61 Correct 1177 ms 57800 KB Output is correct
62 Correct 1141 ms 57880 KB Output is correct