답안 #1015628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015628 2024-07-06T15:37:26 Z inesfi 송신탑 (IOI22_towers) C++17
23 / 100
4000 ms 19976 KB
#include "towers.h"
#include<bits/stdc++.h>
using namespace std;

const int DECALAGE=(1<<17);
int pb,avant,apres,rep;
vector<int> h;
vector<pair<int,int>> altitudes;
int arbremax[DECALAGE*2];
set<int> pris;
set<int>::iterator it;

int maxi(int deb,int fin){
    if (deb==fin){
        return arbremax[deb];
    }
    if (deb%2==1){
        return max(arbremax[deb],maxi(deb+1,fin));
    }
    if (fin%2==0){
        return max(arbremax[fin],maxi(deb,fin-1));
    }
    return maxi(deb/2,fin/2);
}

void init(int N,vector<int> H) {
    h=H;
}

int max_towers(int L, int R, int D) {
    for (int i=L;i<=R;i++){
        altitudes.push_back(make_pair(h[i],i));
        arbremax[i+DECALAGE]=h[i];
    }
    for (int i=DECALAGE-1;i>=0;i--){
        arbremax[i]=max(arbremax[i*2],arbremax[i*2+1]);
    }
    sort(altitudes.begin(),altitudes.end());
    for (int i=0;i<(int)altitudes.size();i++){
        it=pris.lower_bound(altitudes[i].second);
        pb=0;
        if (it!=pris.end()){
            apres=*(it);
            if (maxi(altitudes[i].second+DECALAGE,apres+DECALAGE)-altitudes[i].first<D){
                pb=1;
            }
        }
        if (it!=pris.begin()){
            it--;
            avant=*(it);
            if (maxi(avant+DECALAGE,altitudes[i].second+DECALAGE)-altitudes[i].first<D){
                pb=1;
            }
        }
        if (pb==0){
            pris.insert(altitudes[i].second);
            rep++;
        }
    }
    return rep;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4078 ms 18280 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
5 Correct 1 ms 856 KB Output is correct
6 Correct 1 ms 856 KB Output is correct
7 Correct 1 ms 856 KB Output is correct
8 Correct 1 ms 856 KB Output is correct
9 Correct 1 ms 940 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 1 ms 856 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 1 ms 856 KB Output is correct
16 Correct 1 ms 856 KB Output is correct
17 Correct 1 ms 856 KB Output is correct
18 Correct 1 ms 856 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 1 ms 856 KB Output is correct
21 Correct 1 ms 856 KB Output is correct
22 Correct 1 ms 856 KB Output is correct
23 Correct 1 ms 856 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 1 ms 856 KB Output is correct
26 Correct 1 ms 856 KB Output is correct
27 Correct 1 ms 856 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 856 KB Output is correct
30 Correct 1 ms 856 KB Output is correct
31 Correct 1 ms 856 KB Output is correct
32 Correct 2 ms 856 KB Output is correct
33 Correct 1 ms 856 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
5 Correct 1 ms 856 KB Output is correct
6 Correct 1 ms 856 KB Output is correct
7 Correct 1 ms 856 KB Output is correct
8 Correct 1 ms 856 KB Output is correct
9 Correct 1 ms 940 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 1 ms 856 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 1 ms 856 KB Output is correct
16 Correct 1 ms 856 KB Output is correct
17 Correct 1 ms 856 KB Output is correct
18 Correct 1 ms 856 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 1 ms 856 KB Output is correct
21 Correct 1 ms 856 KB Output is correct
22 Correct 1 ms 856 KB Output is correct
23 Correct 1 ms 856 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 1 ms 856 KB Output is correct
26 Correct 1 ms 856 KB Output is correct
27 Correct 1 ms 856 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 856 KB Output is correct
30 Correct 1 ms 856 KB Output is correct
31 Correct 1 ms 856 KB Output is correct
32 Correct 2 ms 856 KB Output is correct
33 Correct 1 ms 856 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 856 KB Output is correct
36 Correct 10 ms 1952 KB Output is correct
37 Correct 24 ms 2512 KB Output is correct
38 Correct 11 ms 2000 KB Output is correct
39 Correct 15 ms 2256 KB Output is correct
40 Correct 11 ms 2000 KB Output is correct
41 Correct 30 ms 3476 KB Output is correct
42 Correct 9 ms 1724 KB Output is correct
43 Correct 13 ms 2860 KB Output is correct
44 Correct 11 ms 1988 KB Output is correct
45 Correct 9 ms 1744 KB Output is correct
46 Correct 12 ms 1744 KB Output is correct
47 Correct 17 ms 2512 KB Output is correct
48 Correct 14 ms 2512 KB Output is correct
49 Correct 9 ms 2000 KB Output is correct
50 Correct 11 ms 2240 KB Output is correct
51 Correct 12 ms 2500 KB Output is correct
52 Correct 46 ms 4468 KB Output is correct
53 Correct 37 ms 5064 KB Output is correct
54 Correct 41 ms 5060 KB Output is correct
55 Correct 18 ms 3428 KB Output is correct
56 Correct 24 ms 3264 KB Output is correct
57 Correct 31 ms 3288 KB Output is correct
58 Correct 33 ms 3788 KB Output is correct
59 Correct 38 ms 4044 KB Output is correct
60 Correct 46 ms 5060 KB Output is correct
61 Correct 45 ms 4784 KB Output is correct
62 Correct 42 ms 4300 KB Output is correct
63 Correct 35 ms 4832 KB Output is correct
64 Correct 25 ms 3276 KB Output is correct
65 Correct 19 ms 3276 KB Output is correct
66 Correct 21 ms 3368 KB Output is correct
67 Correct 19 ms 3276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4040 ms 19976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4051 ms 19584 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
5 Correct 1 ms 856 KB Output is correct
6 Correct 1 ms 856 KB Output is correct
7 Correct 1 ms 856 KB Output is correct
8 Correct 1 ms 856 KB Output is correct
9 Correct 1 ms 940 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 1 ms 856 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 1 ms 856 KB Output is correct
16 Correct 1 ms 856 KB Output is correct
17 Correct 1 ms 856 KB Output is correct
18 Correct 1 ms 856 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 1 ms 856 KB Output is correct
21 Correct 1 ms 856 KB Output is correct
22 Correct 1 ms 856 KB Output is correct
23 Correct 1 ms 856 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 1 ms 856 KB Output is correct
26 Correct 1 ms 856 KB Output is correct
27 Correct 1 ms 856 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 856 KB Output is correct
30 Correct 1 ms 856 KB Output is correct
31 Correct 1 ms 856 KB Output is correct
32 Correct 2 ms 856 KB Output is correct
33 Correct 1 ms 856 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 856 KB Output is correct
36 Correct 10 ms 1952 KB Output is correct
37 Correct 24 ms 2512 KB Output is correct
38 Correct 11 ms 2000 KB Output is correct
39 Correct 15 ms 2256 KB Output is correct
40 Correct 11 ms 2000 KB Output is correct
41 Correct 30 ms 3476 KB Output is correct
42 Correct 9 ms 1724 KB Output is correct
43 Correct 13 ms 2860 KB Output is correct
44 Correct 11 ms 1988 KB Output is correct
45 Correct 9 ms 1744 KB Output is correct
46 Correct 12 ms 1744 KB Output is correct
47 Correct 17 ms 2512 KB Output is correct
48 Correct 14 ms 2512 KB Output is correct
49 Correct 9 ms 2000 KB Output is correct
50 Correct 11 ms 2240 KB Output is correct
51 Correct 12 ms 2500 KB Output is correct
52 Correct 46 ms 4468 KB Output is correct
53 Correct 37 ms 5064 KB Output is correct
54 Correct 41 ms 5060 KB Output is correct
55 Correct 18 ms 3428 KB Output is correct
56 Correct 24 ms 3264 KB Output is correct
57 Correct 31 ms 3288 KB Output is correct
58 Correct 33 ms 3788 KB Output is correct
59 Correct 38 ms 4044 KB Output is correct
60 Correct 46 ms 5060 KB Output is correct
61 Correct 45 ms 4784 KB Output is correct
62 Correct 42 ms 4300 KB Output is correct
63 Correct 35 ms 4832 KB Output is correct
64 Correct 25 ms 3276 KB Output is correct
65 Correct 19 ms 3276 KB Output is correct
66 Correct 21 ms 3368 KB Output is correct
67 Correct 19 ms 3276 KB Output is correct
68 Execution timed out 4040 ms 19976 KB Time limit exceeded
69 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4078 ms 18280 KB Time limit exceeded
2 Halted 0 ms 0 KB -