# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
88151 |
2018-12-04T05:18:03 Z |
Scayre |
Money (IZhO17_money) |
C++14 |
|
784 ms |
164836 KB |
///////////////////////////
// INFO //
// //
// Handle -> Scayre //
// //
// Template vers. 1.1 //
// //
// It'll be accepted //
// //
///////////////////////////
//████╗████████╗██╗███████╗══███╗═══███╗████████╗════//
//═██╔╝═══██╔══╝╚█║██╔════╝══████╗═████║██╔═════╝═══//
//═██║════██║════╚╝███████╗══██╔████╔██║█████╗══════//
//═██║════██║══════╚════██║══██║╚██╔╝██║██╔══╝══════//
//████╗═══██║══════███████║══██║═╚═╝═██║███████╗═════//
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <complex>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);
#define f first
#define s second
#define inf (int)1e9 + 7
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp(x,y) make_pair(x,y)
#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)
#define pb push_back
#define ppb pop_back
#define bitcoin __builtin_popcount
#define endl "\n"
#define in(x) insert(x)
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define pw2(x) (1<<x) //2^x
#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)
#define sqr(x) ((x) * 1ll * (x))
#define UpdateRandom srand (time(NULL));
using namespace std;
const int N = (int)1e6 + 7, MOD = (int)1e9 + 7;
int n,m;
int a[N];
int ans;
ll t[N*4];
void add(int v,int l,int r,int pos){
if(l==r){
t[v]++;
return;
}
int md=(l+r)/2;
if(md>=pos)add(v+v,l,md,pos);
else add(v+v+1,md+1,r,pos);
t[v]=t[v+v]+t[v+v+1];
}
ll get(int v,int l,int r,int L,int R){
if(R<L){
return 0;
}
if(L>r || R<l){
return 0;
}
if(L<=l && R>=r){
return t[v];
}
int md=(l+r)/2;
return get(v+v,l,md,L,R)+get(v+v+1,md+1,r,L,R);
}
int main(){
#ifdef IOI2019
freopen ("in.txt", "r", stdin);
#endif
NFS
cin >> n;
for(int i=1;i<=n;i++){
cin >> a[i];
}
for(int i=1;i<=n;i++){
int l=i,r=i;
for(int j=i+1;j<=n;j++){
if(a[r]<=a[j] && get(1,1,1e6,a[l]+1,a[j]-1)==0){
r=j;
}
else break;
}
for(int j=l;j<=r;j++){
add(1,1,1e6,a[j]);
}
i=r;
ans++;
}
cout << ans << endl;
#ifdef IOI2019
cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
#endif
ioi
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
624 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
644 KB |
Output is correct |
7 |
Correct |
2 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
704 KB |
Output is correct |
9 |
Correct |
3 ms |
708 KB |
Output is correct |
10 |
Correct |
2 ms |
724 KB |
Output is correct |
11 |
Correct |
3 ms |
856 KB |
Output is correct |
12 |
Correct |
2 ms |
856 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
1108 KB |
Output is correct |
16 |
Correct |
3 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
624 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
644 KB |
Output is correct |
7 |
Correct |
2 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
704 KB |
Output is correct |
9 |
Correct |
3 ms |
708 KB |
Output is correct |
10 |
Correct |
2 ms |
724 KB |
Output is correct |
11 |
Correct |
3 ms |
856 KB |
Output is correct |
12 |
Correct |
2 ms |
856 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
1108 KB |
Output is correct |
16 |
Correct |
3 ms |
1108 KB |
Output is correct |
17 |
Correct |
2 ms |
1108 KB |
Output is correct |
18 |
Correct |
2 ms |
1136 KB |
Output is correct |
19 |
Correct |
2 ms |
1136 KB |
Output is correct |
20 |
Correct |
2 ms |
1136 KB |
Output is correct |
21 |
Correct |
2 ms |
1136 KB |
Output is correct |
22 |
Correct |
3 ms |
1136 KB |
Output is correct |
23 |
Correct |
2 ms |
1136 KB |
Output is correct |
24 |
Correct |
2 ms |
1136 KB |
Output is correct |
25 |
Correct |
3 ms |
1280 KB |
Output is correct |
26 |
Correct |
3 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
624 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
644 KB |
Output is correct |
7 |
Correct |
2 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
704 KB |
Output is correct |
9 |
Correct |
3 ms |
708 KB |
Output is correct |
10 |
Correct |
2 ms |
724 KB |
Output is correct |
11 |
Correct |
3 ms |
856 KB |
Output is correct |
12 |
Correct |
2 ms |
856 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
1108 KB |
Output is correct |
16 |
Correct |
3 ms |
1108 KB |
Output is correct |
17 |
Correct |
2 ms |
1108 KB |
Output is correct |
18 |
Correct |
2 ms |
1136 KB |
Output is correct |
19 |
Correct |
2 ms |
1136 KB |
Output is correct |
20 |
Correct |
2 ms |
1136 KB |
Output is correct |
21 |
Correct |
2 ms |
1136 KB |
Output is correct |
22 |
Correct |
3 ms |
1136 KB |
Output is correct |
23 |
Correct |
2 ms |
1136 KB |
Output is correct |
24 |
Correct |
2 ms |
1136 KB |
Output is correct |
25 |
Correct |
3 ms |
1280 KB |
Output is correct |
26 |
Correct |
3 ms |
1280 KB |
Output is correct |
27 |
Correct |
2 ms |
1280 KB |
Output is correct |
28 |
Correct |
2 ms |
1280 KB |
Output is correct |
29 |
Correct |
2 ms |
1280 KB |
Output is correct |
30 |
Correct |
3 ms |
1280 KB |
Output is correct |
31 |
Correct |
2 ms |
1280 KB |
Output is correct |
32 |
Correct |
2 ms |
1280 KB |
Output is correct |
33 |
Correct |
2 ms |
1280 KB |
Output is correct |
34 |
Correct |
2 ms |
1280 KB |
Output is correct |
35 |
Correct |
2 ms |
1280 KB |
Output is correct |
36 |
Correct |
2 ms |
1280 KB |
Output is correct |
37 |
Correct |
6 ms |
3932 KB |
Output is correct |
38 |
Correct |
6 ms |
3932 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
500 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
624 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
644 KB |
Output is correct |
7 |
Correct |
2 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
704 KB |
Output is correct |
9 |
Correct |
3 ms |
708 KB |
Output is correct |
10 |
Correct |
2 ms |
724 KB |
Output is correct |
11 |
Correct |
3 ms |
856 KB |
Output is correct |
12 |
Correct |
2 ms |
856 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
1108 KB |
Output is correct |
16 |
Correct |
3 ms |
1108 KB |
Output is correct |
17 |
Correct |
2 ms |
1108 KB |
Output is correct |
18 |
Correct |
2 ms |
1136 KB |
Output is correct |
19 |
Correct |
2 ms |
1136 KB |
Output is correct |
20 |
Correct |
2 ms |
1136 KB |
Output is correct |
21 |
Correct |
2 ms |
1136 KB |
Output is correct |
22 |
Correct |
3 ms |
1136 KB |
Output is correct |
23 |
Correct |
2 ms |
1136 KB |
Output is correct |
24 |
Correct |
2 ms |
1136 KB |
Output is correct |
25 |
Correct |
3 ms |
1280 KB |
Output is correct |
26 |
Correct |
3 ms |
1280 KB |
Output is correct |
27 |
Correct |
2 ms |
1280 KB |
Output is correct |
28 |
Correct |
2 ms |
1280 KB |
Output is correct |
29 |
Correct |
2 ms |
1280 KB |
Output is correct |
30 |
Correct |
3 ms |
1280 KB |
Output is correct |
31 |
Correct |
2 ms |
1280 KB |
Output is correct |
32 |
Correct |
2 ms |
1280 KB |
Output is correct |
33 |
Correct |
2 ms |
1280 KB |
Output is correct |
34 |
Correct |
2 ms |
1280 KB |
Output is correct |
35 |
Correct |
2 ms |
1280 KB |
Output is correct |
36 |
Correct |
2 ms |
1280 KB |
Output is correct |
37 |
Correct |
6 ms |
3932 KB |
Output is correct |
38 |
Correct |
6 ms |
3932 KB |
Output is correct |
39 |
Correct |
152 ms |
6116 KB |
Output is correct |
40 |
Correct |
227 ms |
13036 KB |
Output is correct |
41 |
Correct |
105 ms |
13644 KB |
Output is correct |
42 |
Correct |
102 ms |
16256 KB |
Output is correct |
43 |
Correct |
74 ms |
17504 KB |
Output is correct |
44 |
Correct |
282 ms |
26988 KB |
Output is correct |
45 |
Correct |
274 ms |
33612 KB |
Output is correct |
46 |
Correct |
274 ms |
40664 KB |
Output is correct |
47 |
Correct |
260 ms |
47300 KB |
Output is correct |
48 |
Correct |
257 ms |
54152 KB |
Output is correct |
49 |
Correct |
528 ms |
77184 KB |
Output is correct |
50 |
Correct |
481 ms |
84052 KB |
Output is correct |
51 |
Correct |
545 ms |
90720 KB |
Output is correct |
52 |
Correct |
540 ms |
97528 KB |
Output is correct |
53 |
Correct |
546 ms |
104380 KB |
Output is correct |
54 |
Correct |
557 ms |
110920 KB |
Output is correct |
55 |
Correct |
775 ms |
117640 KB |
Output is correct |
56 |
Correct |
776 ms |
124428 KB |
Output is correct |
57 |
Correct |
784 ms |
131136 KB |
Output is correct |
58 |
Correct |
764 ms |
137904 KB |
Output is correct |
59 |
Correct |
681 ms |
144652 KB |
Output is correct |
60 |
Correct |
757 ms |
151568 KB |
Output is correct |
61 |
Correct |
732 ms |
158100 KB |
Output is correct |
62 |
Correct |
680 ms |
164836 KB |
Output is correct |