# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
333580 | 2020-12-07T05:19:52 Z | tengiz05 | Money (IZhO17_money) | C++17 | 2 ms | 364 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define pb push_back #define pii pair<int, int> #define ff first #define ss second #define PI acos(-1) #define ld long double const int mod = 1e9+7, N = 1e6+5; int msb(int val){return sizeof(int)*8-__builtin_clzll(val);} int a[N], n, m, k; void solve(int test_case){ int i, j; cin >> n; set<int> s; s.insert(mod); for(i=1;i<=n;i++){ cin >> a[i]; } int ans = 0; for(i=1;i<=n;i++){ ans++; j = i; int need = *s.upper_bound(a[i]); s.insert(a[i]); while(i+1 <= n && a[i+1] > a[i] && a[i+1] < need){ i++; s.insert(a[i]); } } cout << ans << '\n'; return; } signed main(){ FASTIO; #define MULTITEST 0 #if MULTITEST int ___T; cin >> ___T; for(int T_CASE = 1; T_CASE <= ___T; T_CASE++) solve(T_CASE); #else solve(1); #endif return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 2 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 | 2 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 | 2 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 | 2 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 | - |