답안 #1072246

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072246 2024-08-23T15:56:07 Z vjudge1 송신탑 (IOI22_towers) C++17
11 / 100
4000 ms 1604 KB
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx2")
// #pragma GCC target("popcnt")
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using lld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int,int>;
using pll = pair<ll, ll>;
using vii = vector<ii>;
using vpll = vector<pll>;
 
#define endl '\n'
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define gcd(a,b) __gcd(a,b)
#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fls cout.flush()
 
#define fore(i,l,r) for(auto i=l;i<r;i++)
#define fo(i,n) fore(i,0,n)
#define forex(i,r,l) for(auto i=r; i>=l;i--)
#define ffo(i,n) forex(i,n-1,0)

bool cmin(int &a, int b){if(b<a){a=b;return 1;}return 0;}
bool cmax(int &a, int b){if(b>a){a=b;return 1;}return 0;}
void valid(ll in){cout<<((in)?"YES\n":"NO\n");}
ll lcm(ll a, ll b){return (a/gcd(a,b))*b;}
ll gauss(ll n){return (n*(n+1))/2;}
// const int LOG = 20;
// struct SparseTable{
//     vector<vpll> sp;
//     ll n;
//     SparseTable() {}
//     SparseTable(ll n): n(n), sp(n+3, vpll(LOG, mp(0,0))) {}
//     pll merge(pll a, pll b){
//         return {min(a.fi, b.fi), max(a.se,b.se)};
//     }
//     void build(){
//         fore(b, 1, LOG) {
//             fo(i, n-(1<<b)+1) {
//                 sp[i][b] = merge(sp[i][b-1], sp[i+(1<<(b-1))][b-1]);
//             }
//         }
//     }
// };
int n;
vi h;
// SparseTable qs;
void init(int nn, vi hh){
    n = nn;
    h = hh;
    // qs = SparseTable(n);
    // fo(i, n) qs.sp[i][0] = {h[i], h[i]};
    // qs.build();
}
int max_towers(int l,int r,int d){
    vi dp(n+1, 1);
    int ans = 0;
    fore(i, l, r+1){
        int mx = -1e9;
        fore(j, i+1, r+1){
            if(mx-d >= h[i] && mx-d >= h[j]){
                dp[j] = max(dp[j], dp[i] + 1);
            }
            mx = max(mx, h[j]);
        }
        ans = max(ans, dp[i]);
    }
    return ans;
}
// void test_case(){
//     ll n;
//     cin >> n;
//     vll h(n);
//     fo(i, n) cin >> h[i];
//     init(n, h);
//     ll Q;
//     cin >> Q;
//     while(Q--) {
//         ll l, r, d;
//         cin >> l >> r >> d;
//         cout << max_towers(l, r, d) << "\n";
//     }
// }

// int main(){cin.tie(0)->sync_with_stdio(0);
//     int t=1;
//     // cin >> t;
//     while(t--)test_case();
// }
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4024 ms 1132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 420 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 2 ms 456 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 2 ms 344 KB Output is correct
27 Correct 2 ms 344 KB Output is correct
28 Correct 2 ms 344 KB Output is correct
29 Correct 2 ms 344 KB Output is correct
30 Correct 2 ms 344 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 2 ms 344 KB Output is correct
35 Correct 2 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 420 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 2 ms 456 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 2 ms 344 KB Output is correct
27 Correct 2 ms 344 KB Output is correct
28 Correct 2 ms 344 KB Output is correct
29 Correct 2 ms 344 KB Output is correct
30 Correct 2 ms 344 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 2 ms 344 KB Output is correct
35 Correct 2 ms 344 KB Output is correct
36 Correct 255 ms 1360 KB Output is correct
37 Correct 737 ms 1488 KB Output is correct
38 Correct 155 ms 1596 KB Output is correct
39 Correct 414 ms 1488 KB Output is correct
40 Correct 112 ms 1488 KB Output is correct
41 Correct 3192 ms 1600 KB Output is correct
42 Correct 11 ms 1488 KB Output is correct
43 Correct 1102 ms 1488 KB Output is correct
44 Correct 80 ms 1488 KB Output is correct
45 Correct 10 ms 1488 KB Output is correct
46 Correct 9 ms 1604 KB Output is correct
47 Correct 638 ms 1596 KB Output is correct
48 Correct 242 ms 1488 KB Output is correct
49 Correct 39 ms 1488 KB Output is correct
50 Correct 180 ms 1488 KB Output is correct
51 Correct 786 ms 1592 KB Output is correct
52 Execution timed out 4075 ms 1488 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4025 ms 1492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4013 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 420 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 2 ms 456 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 2 ms 344 KB Output is correct
27 Correct 2 ms 344 KB Output is correct
28 Correct 2 ms 344 KB Output is correct
29 Correct 2 ms 344 KB Output is correct
30 Correct 2 ms 344 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 2 ms 344 KB Output is correct
35 Correct 2 ms 344 KB Output is correct
36 Correct 255 ms 1360 KB Output is correct
37 Correct 737 ms 1488 KB Output is correct
38 Correct 155 ms 1596 KB Output is correct
39 Correct 414 ms 1488 KB Output is correct
40 Correct 112 ms 1488 KB Output is correct
41 Correct 3192 ms 1600 KB Output is correct
42 Correct 11 ms 1488 KB Output is correct
43 Correct 1102 ms 1488 KB Output is correct
44 Correct 80 ms 1488 KB Output is correct
45 Correct 10 ms 1488 KB Output is correct
46 Correct 9 ms 1604 KB Output is correct
47 Correct 638 ms 1596 KB Output is correct
48 Correct 242 ms 1488 KB Output is correct
49 Correct 39 ms 1488 KB Output is correct
50 Correct 180 ms 1488 KB Output is correct
51 Correct 786 ms 1592 KB Output is correct
52 Execution timed out 4075 ms 1488 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4024 ms 1132 KB Time limit exceeded
2 Halted 0 ms 0 KB -