답안 #626343

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
626343 2022-08-11T11:54:59 Z whynotshadow 송신탑 (IOI22_towers) C++17
4 / 100
936 ms 1740 KB
#include "towers.h"
#include <bits/stdc++.h>
//#include <cassert>
//#include <cstdio>
#define ll int
//#include <vector>
using namespace std;
vector<ll>v;
const ll N=1e5;
const ll INF=1e9;
ll tr[4*N],sz;
//void build(ll x, ll l_x, ll r_x){
//    if(l_x==r_x) tr[x]=v[l_x-1];
//    else{
//        ll mid=(l_x+r_x)>>1;
//        build(x<<1,l_x,mid);
//        build(x<<1|1,mid+1,r_x);
//        tr[x]=max(tr[x<<1],tr[x<<1|1]);
//    }
//}
//ll GET(ll x, ll l_x, ll r_x, ll l, ll r){
//    if(l_x>r || l>r_x) return -INF;
//    if(l<=l_x && r_x<=r) return tr[x];
//    ll mid=(l_x+r_x)>>1;
//    return max(GET(x<<1,l_x,mid,l,r),GET(x<<1|1,mid+1,r_x,l,r));
//}
void init(int N, std::vector<int> H) {
    for(auto to:H){
        v.push_back(to);
    }
//    sz=1ll;
//    while(sz<N) sz<<=1;
//    build(1ll,1ll,sz);
    sz=0;
    for(int i=1; i<N; i++){
        if(v[i]>v[i-1]) sz=i;
    }
}

int max_towers(int L, int R, int D) {
//    vector<pair<ll,ll>>cur,anss;
//    for(int i=L; i<=R; i++){
//        cur.push_back(make_pair(v[i],i));
//    }
//    sort(cur.begin(),cur.end());
//    for(auto [to,it]:cur){
//        bool fl=0;
//        for(auto [to2,it2]:anss){
//            ll res=GET(1,1,sz,min(it,it2)+2,max(it,it2))-D;
//            if(res>=to && res>=to2 && abs(it-it2)!=1) fl=0;
//            else{
//                fl=1;
//                break;
//            }
//        }
//        if(fl==0) anss.push_back(make_pair(to,it));
//    }
//    return anss.size();
    if(L<=sz && sz<=R && v[L]<=v[sz]-D && v[R]<=v[sz]-D) return 2;
    return 1;
//    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 214 ms 1104 KB Output is correct
2 Correct 936 ms 1740 KB Output is correct
3 Correct 905 ms 1708 KB Output is correct
4 Correct 918 ms 1700 KB Output is correct
5 Correct 736 ms 1732 KB Output is correct
6 Correct 787 ms 1704 KB Output is correct
7 Correct 438 ms 1700 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 520 ms 1708 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 268 ms 720 KB 1st lines differ - on the 1st token, expected: '7197', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 214 ms 1104 KB Output is correct
2 Correct 936 ms 1740 KB Output is correct
3 Correct 905 ms 1708 KB Output is correct
4 Correct 918 ms 1700 KB Output is correct
5 Correct 736 ms 1732 KB Output is correct
6 Correct 787 ms 1704 KB Output is correct
7 Correct 438 ms 1700 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
12 Halted 0 ms 0 KB -