답안 #533254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533254 2022-03-05T08:04:52 Z makanhulia Money (IZhO17_money) C++17
9 / 100
1 ms 316 KB
#include <bits/stdc++.h>
using namespace std;

#define nyahalo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define otsumiko exit(0);
#define mikodanye priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > >
#define mikochi priority_queue<long long, vector<long long>, greater<long long> >

int main() {
  nyahalo
  long long n;
  cin >> n;
  long long ans = 0, a[n+1], pv, ab, l, r, val;
  set<long long> st;
  for (long long i=1; i<=n; i++) {
    cin >> a[i];
  }
  l = 1;
  while (l<=n) {
    ans++;
    r = l+1;
    if (l == 1) {
      val = 1e9;
    } else {
      auto it = st.upper_bound(a[l]);
      val = *it;
    }
    st.insert(a[l]);
    while (r<=n) {
      if (a[r]>val || a[r]<a[r-1]) {
        break;
      }
      st.insert(a[r]);
      r++;
    }
    l = r;
  }
  cout << ans << "\n";
  otsumiko
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:13:30: warning: unused variable 'pv' [-Wunused-variable]
   13 |   long long ans = 0, a[n+1], pv, ab, l, r, val;
      |                              ^~
money.cpp:13:34: warning: unused variable 'ab' [-Wunused-variable]
   13 |   long long ans = 0, a[n+1], pv, ab, l, r, val;
      |                                  ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 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 1 ms 220 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 1 ms 204 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 0 ms 312 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 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 1 ms 220 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 1 ms 204 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 0 ms 312 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Incorrect 1 ms 316 KB Output isn't correct
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 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 1 ms 220 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 1 ms 204 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 0 ms 312 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Incorrect 1 ms 316 KB Output isn't correct
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 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 1 ms 220 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 1 ms 204 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 0 ms 312 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Incorrect 1 ms 316 KB Output isn't correct
18 Halted 0 ms 0 KB -