답안 #37388

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
37388 2017-12-25T03:45:05 Z HardNut Money (IZhO17_money) C++14
45 / 100
1500 ms 52944 KB
#include<bits/stdc++.h>

#define ll long long
#define Add_Speed ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define f first
#define sz size()
#define s second
#define all(s) s.begin(), s.end()
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define inf INT_MAX

                                                                                                                                            
using namespace std;

const int maxn = (int)1e6 + 100;
const int maxM = (int)1e3 + 100;
const int mod = (int)1e9 + 7;
const int maxlog = (int)20;
const int P = mod;                  

int n, a[maxn], ans;
set<int> s;
main () {
  Add_Speed
  cin >> n;
  for(int i = 1; i <= n; i++)
    cin >> a[i];
  s.insert(-1);
  s.insert(inf);
  int i = 1;
  while(i <= n){
    ans++;
    int j = i;
    int x = *s.upper_bound(a[i]);
    while(j + 1 <= n && a[j + 1] >= a[j] && a[j + 1] <= x){
      j++;
    }
    for(int k = i; k <= j; k++)
      s.insert(a[k]);
    i = j + 1;
  } 
  cout << ans;
}

Compilation message

money.cpp:25:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6084 KB Output is correct
2 Correct 0 ms 6084 KB Output is correct
3 Correct 0 ms 6084 KB Output is correct
4 Correct 0 ms 6084 KB Output is correct
5 Correct 0 ms 6084 KB Output is correct
6 Correct 0 ms 6084 KB Output is correct
7 Correct 0 ms 6084 KB Output is correct
8 Correct 0 ms 6084 KB Output is correct
9 Correct 0 ms 6084 KB Output is correct
10 Correct 0 ms 6084 KB Output is correct
11 Correct 0 ms 6084 KB Output is correct
12 Correct 0 ms 6084 KB Output is correct
13 Correct 0 ms 6084 KB Output is correct
14 Correct 0 ms 6084 KB Output is correct
15 Correct 0 ms 6084 KB Output is correct
16 Correct 0 ms 6084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6084 KB Output is correct
2 Correct 0 ms 6084 KB Output is correct
3 Correct 0 ms 6084 KB Output is correct
4 Correct 0 ms 6084 KB Output is correct
5 Correct 0 ms 6084 KB Output is correct
6 Correct 0 ms 6084 KB Output is correct
7 Correct 0 ms 6084 KB Output is correct
8 Correct 0 ms 6084 KB Output is correct
9 Correct 0 ms 6084 KB Output is correct
10 Correct 0 ms 6084 KB Output is correct
11 Correct 0 ms 6084 KB Output is correct
12 Correct 0 ms 6084 KB Output is correct
13 Correct 0 ms 6084 KB Output is correct
14 Correct 0 ms 6084 KB Output is correct
15 Correct 0 ms 6084 KB Output is correct
16 Correct 0 ms 6084 KB Output is correct
17 Correct 0 ms 6084 KB Output is correct
18 Correct 0 ms 6084 KB Output is correct
19 Correct 0 ms 6084 KB Output is correct
20 Correct 0 ms 6084 KB Output is correct
21 Correct 0 ms 6084 KB Output is correct
22 Correct 0 ms 6084 KB Output is correct
23 Correct 0 ms 6084 KB Output is correct
24 Correct 0 ms 6084 KB Output is correct
25 Correct 0 ms 6084 KB Output is correct
26 Correct 0 ms 6084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6084 KB Output is correct
2 Correct 0 ms 6084 KB Output is correct
3 Correct 0 ms 6084 KB Output is correct
4 Correct 0 ms 6084 KB Output is correct
5 Correct 0 ms 6084 KB Output is correct
6 Correct 0 ms 6084 KB Output is correct
7 Correct 0 ms 6084 KB Output is correct
8 Correct 0 ms 6084 KB Output is correct
9 Correct 0 ms 6084 KB Output is correct
10 Correct 0 ms 6084 KB Output is correct
11 Correct 0 ms 6084 KB Output is correct
12 Correct 0 ms 6084 KB Output is correct
13 Correct 0 ms 6084 KB Output is correct
14 Correct 0 ms 6084 KB Output is correct
15 Correct 0 ms 6084 KB Output is correct
16 Correct 0 ms 6084 KB Output is correct
17 Correct 0 ms 6084 KB Output is correct
18 Correct 0 ms 6084 KB Output is correct
19 Correct 0 ms 6084 KB Output is correct
20 Correct 0 ms 6084 KB Output is correct
21 Correct 0 ms 6084 KB Output is correct
22 Correct 0 ms 6084 KB Output is correct
23 Correct 0 ms 6084 KB Output is correct
24 Correct 0 ms 6084 KB Output is correct
25 Correct 0 ms 6084 KB Output is correct
26 Correct 0 ms 6084 KB Output is correct
27 Correct 0 ms 6084 KB Output is correct
28 Correct 0 ms 6084 KB Output is correct
29 Correct 0 ms 6084 KB Output is correct
30 Correct 0 ms 6084 KB Output is correct
31 Correct 0 ms 6084 KB Output is correct
32 Correct 0 ms 6084 KB Output is correct
33 Correct 0 ms 6084 KB Output is correct
34 Correct 0 ms 6084 KB Output is correct
35 Correct 0 ms 6084 KB Output is correct
36 Correct 0 ms 6084 KB Output is correct
37 Correct 0 ms 6084 KB Output is correct
38 Correct 0 ms 6084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6084 KB Output is correct
2 Correct 0 ms 6084 KB Output is correct
3 Correct 0 ms 6084 KB Output is correct
4 Correct 0 ms 6084 KB Output is correct
5 Correct 0 ms 6084 KB Output is correct
6 Correct 0 ms 6084 KB Output is correct
7 Correct 0 ms 6084 KB Output is correct
8 Correct 0 ms 6084 KB Output is correct
9 Correct 0 ms 6084 KB Output is correct
10 Correct 0 ms 6084 KB Output is correct
11 Correct 0 ms 6084 KB Output is correct
12 Correct 0 ms 6084 KB Output is correct
13 Correct 0 ms 6084 KB Output is correct
14 Correct 0 ms 6084 KB Output is correct
15 Correct 0 ms 6084 KB Output is correct
16 Correct 0 ms 6084 KB Output is correct
17 Correct 0 ms 6084 KB Output is correct
18 Correct 0 ms 6084 KB Output is correct
19 Correct 0 ms 6084 KB Output is correct
20 Correct 0 ms 6084 KB Output is correct
21 Correct 0 ms 6084 KB Output is correct
22 Correct 0 ms 6084 KB Output is correct
23 Correct 0 ms 6084 KB Output is correct
24 Correct 0 ms 6084 KB Output is correct
25 Correct 0 ms 6084 KB Output is correct
26 Correct 0 ms 6084 KB Output is correct
27 Correct 0 ms 6084 KB Output is correct
28 Correct 0 ms 6084 KB Output is correct
29 Correct 0 ms 6084 KB Output is correct
30 Correct 0 ms 6084 KB Output is correct
31 Correct 0 ms 6084 KB Output is correct
32 Correct 0 ms 6084 KB Output is correct
33 Correct 0 ms 6084 KB Output is correct
34 Correct 0 ms 6084 KB Output is correct
35 Correct 0 ms 6084 KB Output is correct
36 Correct 0 ms 6084 KB Output is correct
37 Correct 0 ms 6084 KB Output is correct
38 Correct 0 ms 6084 KB Output is correct
39 Correct 76 ms 6084 KB Output is correct
40 Correct 116 ms 6084 KB Output is correct
41 Correct 49 ms 6084 KB Output is correct
42 Correct 59 ms 6084 KB Output is correct
43 Correct 29 ms 6084 KB Output is correct
44 Correct 139 ms 6084 KB Output is correct
45 Correct 126 ms 6084 KB Output is correct
46 Correct 146 ms 6084 KB Output is correct
47 Correct 129 ms 6084 KB Output is correct
48 Correct 126 ms 6084 KB Output is correct
49 Correct 653 ms 24564 KB Output is correct
50 Correct 799 ms 24564 KB Output is correct
51 Correct 676 ms 24564 KB Output is correct
52 Correct 686 ms 24564 KB Output is correct
53 Correct 693 ms 24564 KB Output is correct
54 Correct 703 ms 24564 KB Output is correct
55 Execution timed out 1500 ms 52944 KB Execution timed out
56 Halted 0 ms 0 KB -