| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1298586 | mingga | Money (IZhO17_money) | C++20 | 1 ms | 568 KiB |
#include "bits/stdc++.h"
using namespace std;
#ifdef LOCAL
#include "D:/debug.h"
#define debug(...) cerr << "\033[35m" << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 36
#endif
#define ln "\n"
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define ll long long
const int mod = 1e9 + 7;
const ll inf = 2e18;
const int N = 1e5 + 7;
int n, a[N];
signed main() {
cin.tie(0) -> sync_with_stdio(0);
#define task ""
if(fopen(task ".INP", "r")) {
freopen(task ".INP", "r", stdin);
freopen(task ".OUT", "w", stdout);
}
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
set<pair<int, int>> s;
s.insert({a[1], 1});
int ans = 1;
for(int i = 2; i <= n; i++) {
auto it = s.lower_bound(make_pair(a[i - 1], i - 1));
debug((*it));
if(it == s.end()) continue;
it++;
debug(i, a[i], (*it));
if((*it).fi < a[i]) ans++;
s.insert({a[i], i});
}
cout << ans << ln;
cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
