結果
| 問題 |
No.1715 Dinner 2
|
| コンテスト | |
| ユーザー |
RVindicatio
|
| 提出日時 | 2021-10-22 22:08:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 677 bytes |
| コンパイル時間 | 1,617 ms |
| コンパイル使用メモリ | 170,368 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-23 05:40:26 |
| 合計ジャッジ時間 | 2,691 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 WA * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll inf = 1LL<<60;
int main() {
ll n, d; cin >> n >> d;
vector<ll> p(n), q(n);
for (int i=0; i<n; i++) cin >> p[i] >> q[i];
ll ans = -INF;
for (int i=0; i<n; i++) for (int j=0; j<n; j++) if (i != j) {
ll fd = q[i] - p[i], sd = q[j] - p[j];
if (fd + sd >= 0) ans = max(ans, min(-p[i], fd-p[j]));
else {
ll last = (fd + sd)*(d/2);
if (d & 1) last += fd;
if (d & 1) {
ans = max(ans, min(last - q[i], last - fd - q[j]));
} else {
ans = max(ans, min(last - q[j], last - sd - q[i]));
}
}
}
cout << ans << endl;
}
RVindicatio