# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
35766 |
2017-11-29T12:39:08 Z |
funcsr |
Money (IZhO17_money) |
C++14 |
|
1500 ms |
56852 KB |
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
int N;
int A[1000000];
int L[1000000];
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
cin >> N;
rep(i, N) cin >> A[i];
L[N-1] = N-1;
for (int i=N-2; i>=0; i--) {
if (A[i] <= A[i+1]) L[i] = L[i+1];
else L[i] = i;
}
set<int> vs;
vs.insert(1000001);
rep(i, N) {
int lim = *vs.upper_bound(A[i]);
L[i] = upper_bound(A+i, A+L[i]+1, lim) - A - 1;
vs.insert(A[i]);
}
//rep(i, N) cout << L[i] << ",";cout<<"\n";
assert(is_sorted(L, L+N));
int lo = 0, ctr = 0;
while (lo < N) {
lo = L[lo]+1;
ctr++;
}
cout << ctr << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9992 KB |
Output is correct |
2 |
Correct |
0 ms |
9992 KB |
Output is correct |
3 |
Correct |
0 ms |
9992 KB |
Output is correct |
4 |
Correct |
0 ms |
9992 KB |
Output is correct |
5 |
Correct |
0 ms |
9992 KB |
Output is correct |
6 |
Correct |
0 ms |
9992 KB |
Output is correct |
7 |
Correct |
0 ms |
9992 KB |
Output is correct |
8 |
Correct |
0 ms |
9992 KB |
Output is correct |
9 |
Correct |
0 ms |
9992 KB |
Output is correct |
10 |
Correct |
0 ms |
9992 KB |
Output is correct |
11 |
Correct |
0 ms |
9992 KB |
Output is correct |
12 |
Correct |
0 ms |
9992 KB |
Output is correct |
13 |
Correct |
0 ms |
9992 KB |
Output is correct |
14 |
Correct |
0 ms |
9992 KB |
Output is correct |
15 |
Correct |
0 ms |
9992 KB |
Output is correct |
16 |
Correct |
0 ms |
9992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9992 KB |
Output is correct |
2 |
Correct |
0 ms |
9992 KB |
Output is correct |
3 |
Correct |
0 ms |
9992 KB |
Output is correct |
4 |
Correct |
0 ms |
9992 KB |
Output is correct |
5 |
Correct |
0 ms |
9992 KB |
Output is correct |
6 |
Correct |
0 ms |
9992 KB |
Output is correct |
7 |
Correct |
0 ms |
9992 KB |
Output is correct |
8 |
Correct |
0 ms |
9992 KB |
Output is correct |
9 |
Correct |
0 ms |
9992 KB |
Output is correct |
10 |
Correct |
0 ms |
9992 KB |
Output is correct |
11 |
Correct |
0 ms |
9992 KB |
Output is correct |
12 |
Correct |
0 ms |
9992 KB |
Output is correct |
13 |
Correct |
0 ms |
9992 KB |
Output is correct |
14 |
Correct |
0 ms |
9992 KB |
Output is correct |
15 |
Correct |
0 ms |
9992 KB |
Output is correct |
16 |
Correct |
0 ms |
9992 KB |
Output is correct |
17 |
Correct |
0 ms |
9992 KB |
Output is correct |
18 |
Correct |
0 ms |
9992 KB |
Output is correct |
19 |
Correct |
0 ms |
9992 KB |
Output is correct |
20 |
Correct |
0 ms |
9992 KB |
Output is correct |
21 |
Correct |
0 ms |
9992 KB |
Output is correct |
22 |
Correct |
0 ms |
9992 KB |
Output is correct |
23 |
Correct |
0 ms |
9992 KB |
Output is correct |
24 |
Correct |
0 ms |
9992 KB |
Output is correct |
25 |
Correct |
0 ms |
9992 KB |
Output is correct |
26 |
Correct |
0 ms |
9992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9992 KB |
Output is correct |
2 |
Correct |
0 ms |
9992 KB |
Output is correct |
3 |
Correct |
0 ms |
9992 KB |
Output is correct |
4 |
Correct |
0 ms |
9992 KB |
Output is correct |
5 |
Correct |
0 ms |
9992 KB |
Output is correct |
6 |
Correct |
0 ms |
9992 KB |
Output is correct |
7 |
Correct |
0 ms |
9992 KB |
Output is correct |
8 |
Correct |
0 ms |
9992 KB |
Output is correct |
9 |
Correct |
0 ms |
9992 KB |
Output is correct |
10 |
Correct |
0 ms |
9992 KB |
Output is correct |
11 |
Correct |
0 ms |
9992 KB |
Output is correct |
12 |
Correct |
0 ms |
9992 KB |
Output is correct |
13 |
Correct |
0 ms |
9992 KB |
Output is correct |
14 |
Correct |
0 ms |
9992 KB |
Output is correct |
15 |
Correct |
0 ms |
9992 KB |
Output is correct |
16 |
Correct |
0 ms |
9992 KB |
Output is correct |
17 |
Correct |
0 ms |
9992 KB |
Output is correct |
18 |
Correct |
0 ms |
9992 KB |
Output is correct |
19 |
Correct |
0 ms |
9992 KB |
Output is correct |
20 |
Correct |
0 ms |
9992 KB |
Output is correct |
21 |
Correct |
0 ms |
9992 KB |
Output is correct |
22 |
Correct |
0 ms |
9992 KB |
Output is correct |
23 |
Correct |
0 ms |
9992 KB |
Output is correct |
24 |
Correct |
0 ms |
9992 KB |
Output is correct |
25 |
Correct |
0 ms |
9992 KB |
Output is correct |
26 |
Correct |
0 ms |
9992 KB |
Output is correct |
27 |
Correct |
0 ms |
9992 KB |
Output is correct |
28 |
Correct |
0 ms |
9992 KB |
Output is correct |
29 |
Correct |
0 ms |
9992 KB |
Output is correct |
30 |
Correct |
0 ms |
9992 KB |
Output is correct |
31 |
Correct |
0 ms |
9992 KB |
Output is correct |
32 |
Correct |
0 ms |
9992 KB |
Output is correct |
33 |
Correct |
0 ms |
9992 KB |
Output is correct |
34 |
Correct |
0 ms |
9992 KB |
Output is correct |
35 |
Correct |
0 ms |
9992 KB |
Output is correct |
36 |
Correct |
0 ms |
9992 KB |
Output is correct |
37 |
Correct |
0 ms |
9992 KB |
Output is correct |
38 |
Correct |
0 ms |
9992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9992 KB |
Output is correct |
2 |
Correct |
0 ms |
9992 KB |
Output is correct |
3 |
Correct |
0 ms |
9992 KB |
Output is correct |
4 |
Correct |
0 ms |
9992 KB |
Output is correct |
5 |
Correct |
0 ms |
9992 KB |
Output is correct |
6 |
Correct |
0 ms |
9992 KB |
Output is correct |
7 |
Correct |
0 ms |
9992 KB |
Output is correct |
8 |
Correct |
0 ms |
9992 KB |
Output is correct |
9 |
Correct |
0 ms |
9992 KB |
Output is correct |
10 |
Correct |
0 ms |
9992 KB |
Output is correct |
11 |
Correct |
0 ms |
9992 KB |
Output is correct |
12 |
Correct |
0 ms |
9992 KB |
Output is correct |
13 |
Correct |
0 ms |
9992 KB |
Output is correct |
14 |
Correct |
0 ms |
9992 KB |
Output is correct |
15 |
Correct |
0 ms |
9992 KB |
Output is correct |
16 |
Correct |
0 ms |
9992 KB |
Output is correct |
17 |
Correct |
0 ms |
9992 KB |
Output is correct |
18 |
Correct |
0 ms |
9992 KB |
Output is correct |
19 |
Correct |
0 ms |
9992 KB |
Output is correct |
20 |
Correct |
0 ms |
9992 KB |
Output is correct |
21 |
Correct |
0 ms |
9992 KB |
Output is correct |
22 |
Correct |
0 ms |
9992 KB |
Output is correct |
23 |
Correct |
0 ms |
9992 KB |
Output is correct |
24 |
Correct |
0 ms |
9992 KB |
Output is correct |
25 |
Correct |
0 ms |
9992 KB |
Output is correct |
26 |
Correct |
0 ms |
9992 KB |
Output is correct |
27 |
Correct |
0 ms |
9992 KB |
Output is correct |
28 |
Correct |
0 ms |
9992 KB |
Output is correct |
29 |
Correct |
0 ms |
9992 KB |
Output is correct |
30 |
Correct |
0 ms |
9992 KB |
Output is correct |
31 |
Correct |
0 ms |
9992 KB |
Output is correct |
32 |
Correct |
0 ms |
9992 KB |
Output is correct |
33 |
Correct |
0 ms |
9992 KB |
Output is correct |
34 |
Correct |
0 ms |
9992 KB |
Output is correct |
35 |
Correct |
0 ms |
9992 KB |
Output is correct |
36 |
Correct |
0 ms |
9992 KB |
Output is correct |
37 |
Correct |
0 ms |
9992 KB |
Output is correct |
38 |
Correct |
0 ms |
9992 KB |
Output is correct |
39 |
Correct |
69 ms |
9992 KB |
Output is correct |
40 |
Correct |
143 ms |
9992 KB |
Output is correct |
41 |
Correct |
56 ms |
9992 KB |
Output is correct |
42 |
Correct |
56 ms |
9992 KB |
Output is correct |
43 |
Correct |
43 ms |
9992 KB |
Output is correct |
44 |
Correct |
143 ms |
9992 KB |
Output is correct |
45 |
Correct |
129 ms |
9992 KB |
Output is correct |
46 |
Correct |
139 ms |
9992 KB |
Output is correct |
47 |
Correct |
126 ms |
9992 KB |
Output is correct |
48 |
Correct |
149 ms |
9992 KB |
Output is correct |
49 |
Correct |
703 ms |
28472 KB |
Output is correct |
50 |
Correct |
719 ms |
28472 KB |
Output is correct |
51 |
Correct |
723 ms |
28472 KB |
Output is correct |
52 |
Correct |
763 ms |
28472 KB |
Output is correct |
53 |
Correct |
639 ms |
28472 KB |
Output is correct |
54 |
Correct |
723 ms |
28472 KB |
Output is correct |
55 |
Execution timed out |
1500 ms |
56852 KB |
Execution timed out |
56 |
Halted |
0 ms |
0 KB |
- |