답안 #836961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
836961 2023-08-24T18:26:05 Z Abrar_Al_Samit 송신탑 (IOI22_towers) C++17
4 / 100
696 ms 1360 KB
#include "towers.h"
#include <bits/stdc++.h>

using namespace std;

//subtask 1

const int nax = 100005;
int n;
int h[nax];
int tp;
void init(int N, vector<int> H) {
  n = N;
  for(int i=0; i<n; ++i) h[i] = H[i];
  if(n==1) return;

  if(H[0]>H[1]) tp = -1;
  if(H[n-2]<H[n-1]) tp = -1;

  for(int i=1; i<n-1; ++i) {
    if(H[i]>max(H[i-1], H[i+1])) {
      tp = i;
      return;
    }
  }
}

int max_towers(int L, int R, int D) {
  if(n==1 || tp==-1 || R-L+1<3) return 1;

  if(tp>L && tp<R) {
    if(min(h[tp]-h[L], h[tp]-h[R])>=D) return 2;
  }
  return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 305 ms 976 KB Output is correct
2 Correct 592 ms 1360 KB Output is correct
3 Correct 562 ms 1360 KB Output is correct
4 Correct 659 ms 1360 KB Output is correct
5 Correct 606 ms 1360 KB Output is correct
6 Correct 696 ms 1352 KB Output is correct
7 Correct 610 ms 1360 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 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 444 ms 1360 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 166 ms 464 KB 1st lines differ - on the 1st token, expected: '7197', 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 Correct 305 ms 976 KB Output is correct
2 Correct 592 ms 1360 KB Output is correct
3 Correct 562 ms 1360 KB Output is correct
4 Correct 659 ms 1360 KB Output is correct
5 Correct 606 ms 1360 KB Output is correct
6 Correct 696 ms 1352 KB Output is correct
7 Correct 610 ms 1360 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 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 -