Submission #657800

# Submission time Handle Problem Language Result Execution time Memory
657800 2022-11-11T07:40:53 Z coding_snorlax Radio Towers (IOI22_towers) C++17
0 / 100
485 ms 1704 KB
#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> All;
void init(int N,vector<int> H){
    for(int i=0;i<N;i++){
        All.push_back(H[i]);
    }
}
int recrution(int L,int R,int D){
    if(L<R){
        return 1;
    }
    int Now_max=-2000000000,Max_place=-1;
    for(int i=L;i<=R;i++){
        if(All[i]>Now_max ){
            Now_max=All[i];
            Max_place=i;
        }
    }
    int flag1=0,flag2=0;
    for(int i=L;i<Max_place;i++){
        if(All[i]+D<=Now_max){
            flag1=1;
        }
    }
    for(int i=Max_place+1;i<=R;i++){
        if(All[i]+D<=Now_max){
            flag2=1;
        }
    }
    if(flag1 && flag2) return recrution(L,Max_place-1,D)+recrution(Max_place+1,R,D);
    else return 1;
}
int max_towers(int L,int R,int D){
    return recrution(L,R,D);
}
# Verdict Execution time Memory Grader output
1 Incorrect 338 ms 1060 KB 12th lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 485 ms 1704 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 275 ms 592 KB 1st lines differ - on the 1st token, expected: '7197', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 338 ms 1060 KB 12th lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -