# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
502076 |
2022-01-05T08:34:32 Z |
reo111 |
Money (IZhO17_money) |
C++17 |
|
1078 ms |
55856 KB |
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//Ofast, avx, avx2, fma
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;*/
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define bpc(a) __builtin_popcount(a)
#define bpcll(a) __builtin_popcountll(a)
#define wtc(a) cerr << (#a) << " = " << a << '\n'
#define setprec(a) cout.precision(a)
#define base ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define file(a) freopen(a".in", "r", stdin); freopen(a".out", "w", stdout);
#define GET4_(a, b, c, d, ...) d
#define FOR_(i, a, b) for (int i = a; i < b; ++i)
#define FOR1(a) FOR_(i, 0, a)
#define FOR2(i, a) FOR_(i, 0, a)
#define FOR3(i, a, b) FOR_(i, a, b)
#define FORC_(...) GET4_(__VA_ARGS__, FOR3, FOR2, FOR1)
#define FOR(...) FORC_(__VA_ARGS__)(__VA_ARGS__)
#define TRV(i, a) for(auto &i : a)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
template <class T> using VC = vector<T>;
template <class T, class V> using PR = pair<T, V>;
//template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//insert(), find_by_order(), order_of_key(), find(), erase(find())*/
template <class T> bool mns(T &a, T b) {return (a > b ? a = b, 1 : 0);}
template <class T> bool mxs(T &a, T b) {return (a < b ? a = b, 1 : 0);}
pii DR[] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
const int INF = 1e9 + 1e7 + 7;
const int MOD = 1e9 + 7;//998244353;//1e9 + 7;
const ll INFLL = 1e18 + 1e16 + 7ll;
const int N = 1e6 + 5;
const int SS = 5e5 + 5; //rank
const int cs = 850;
void Main();
void precalc();
int main() {
base//d
//precalc();
//setprec(10);
int T = 1;
//cin >> T;
FOR(i, 1, T + 1) {
//cout << "Case #" << i << ": ";
Main();
}
return 0;
}
int n, a[N];
void Main() {
cin >> n;
FOR(n) {
cin >> a[i];
}
int ans = 0;
set<int> s;
FOR(n) {
++ans;
if (i == n - 1) {continue; break;}
auto r = s.upper_bound(a[i]);
int rv;
if (r == s.end()) {
rv = INF;
} else {
rv = *r;
}
//cout << i << ' ' << rv << endl;
s.insert(a[i]);
while (i < n - 1 && a[i] <= a[i + 1] && a[i + 1] <= rv) s.insert(a[++i]);
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
324 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
328 KB |
Output is correct |
23 |
Correct |
0 ms |
328 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
324 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
328 KB |
Output is correct |
23 |
Correct |
0 ms |
328 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
0 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
29 |
Correct |
0 ms |
204 KB |
Output is correct |
30 |
Correct |
1 ms |
324 KB |
Output is correct |
31 |
Correct |
0 ms |
204 KB |
Output is correct |
32 |
Correct |
0 ms |
332 KB |
Output is correct |
33 |
Correct |
0 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
320 KB |
Output is correct |
36 |
Correct |
0 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
320 KB |
Output is correct |
38 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
324 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
0 ms |
204 KB |
Output is correct |
22 |
Correct |
0 ms |
328 KB |
Output is correct |
23 |
Correct |
0 ms |
328 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
0 ms |
204 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
29 |
Correct |
0 ms |
204 KB |
Output is correct |
30 |
Correct |
1 ms |
324 KB |
Output is correct |
31 |
Correct |
0 ms |
204 KB |
Output is correct |
32 |
Correct |
0 ms |
332 KB |
Output is correct |
33 |
Correct |
0 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
0 ms |
320 KB |
Output is correct |
36 |
Correct |
0 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
320 KB |
Output is correct |
38 |
Correct |
1 ms |
332 KB |
Output is correct |
39 |
Correct |
50 ms |
5372 KB |
Output is correct |
40 |
Correct |
95 ms |
7532 KB |
Output is correct |
41 |
Correct |
41 ms |
4288 KB |
Output is correct |
42 |
Correct |
37 ms |
3880 KB |
Output is correct |
43 |
Correct |
26 ms |
2864 KB |
Output is correct |
44 |
Correct |
103 ms |
8976 KB |
Output is correct |
45 |
Correct |
103 ms |
8808 KB |
Output is correct |
46 |
Correct |
104 ms |
8872 KB |
Output is correct |
47 |
Correct |
89 ms |
8940 KB |
Output is correct |
48 |
Correct |
96 ms |
8928 KB |
Output is correct |
49 |
Correct |
420 ms |
27528 KB |
Output is correct |
50 |
Correct |
488 ms |
27280 KB |
Output is correct |
51 |
Correct |
412 ms |
27256 KB |
Output is correct |
52 |
Correct |
461 ms |
27564 KB |
Output is correct |
53 |
Correct |
392 ms |
27352 KB |
Output is correct |
54 |
Correct |
412 ms |
27096 KB |
Output is correct |
55 |
Correct |
949 ms |
55792 KB |
Output is correct |
56 |
Correct |
965 ms |
55632 KB |
Output is correct |
57 |
Correct |
1078 ms |
55612 KB |
Output is correct |
58 |
Correct |
962 ms |
55760 KB |
Output is correct |
59 |
Correct |
952 ms |
55856 KB |
Output is correct |
60 |
Correct |
955 ms |
55724 KB |
Output is correct |
61 |
Correct |
973 ms |
55548 KB |
Output is correct |
62 |
Correct |
961 ms |
55596 KB |
Output is correct |