結果
| 問題 | No.3513 Greedy Yokan Party |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2026-04-24 21:29:50 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,231 ms / 2,000 ms |
| コード長 | 865 bytes |
| 記録 | |
| コンパイル時間 | 3,315 ms |
| コンパイル使用メモリ | 276,532 KB |
| 実行使用メモリ | 15,996 KB |
| 最終ジャッジ日時 | 2026-04-24 21:30:20 |
| 合計ジャッジ時間 | 26,195 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 26 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001LL
int main(){
int N,L;
cin>>N>>L;
int K;
cin>>K;
vector<long long> a(N);
rep(i,N){
cin>>a[i];
}
a.push_back(L);
a.insert(a.begin(),0);
N = a.size();
long long ok = 0,ng = L+1;
while(ng-ok>1LL){
long long mid = (ok+ng)/2;
vector dp(N,vector<int>(3,-Inf32));
dp[0][0] = 0;
rep(i,N-1){
rep(j,3){
dp[i+1][j] = max(dp[i][j]+1,dp[i+1][j]);
int d = distance(a.begin(),lower_bound(a.begin(),a.end(),a[i] + mid));
if(j!=2 && d != a.size()){
dp[d][j+1] = max(dp[i][j]+1,dp[d][j+1]);
}
}
}
if(dp[N-1][2] >= K+1)ok = mid;
else ng = mid;
}
cout<<ok<<endl;
return 0;
}
沙耶花