# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
813709 | LIF | Radio Towers (IOI22_towers) | C++17 | 4045 ms | 1852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towers.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
int n;
pair <int,int> aa[300005];
void init(int N, std::vector<int> H) {
n = N;
for(int i=0;i<H.size();i++)
{
aa[i+1].first = H[i];
aa[i+1].second = i;
}
sort(aa+1,aa+n+1);
return;
}
bool choose[300005];
int max_towers(int L, int R, int D)
{
int ans = 0;
for(int i=1;i<=n;i++)choose[i] = false;
for(int i=1;i<=n;i++)
{
int xx = aa[i].second;
int leftmax = -1;
bool flag = true;
for(int j=xx-1;j>=1;j--)
{
if(choose[j] == false)leftmax = max(leftmax,aa[j].first);
else
{
if(aa[j].first <= leftmax - D && aa[xx].first <= leftmax - D)continue;
else
{
flag = false;
break;
}
}
}
int rightmax = -1;
for(int j=xx+1;j<=n;j++)
{
if(choose[j] == false)rightmax = max(rightmax,aa[j].first);
else
{
if(aa[j].first <= rightmax - D && aa[xx].first <= rightmax - D)continue;
else
{
flag = false;
break;
}
}
}
if(flag == true)
{
ans++;
choose[xx] = true;
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |