結果
| 問題 | No.771 しおり |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-02 23:55:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 505 bytes |
| コンパイル時間 | 1,551 ms |
| コンパイル使用メモリ | 168,880 KB |
| 実行使用メモリ | 17,080 KB |
| 最終ジャッジ日時 | 2024-07-01 05:29:00 |
| 合計ジャッジ時間 | 8,159 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 42 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, _##i = (n); i < _##i; ++i)
#define INF 100000
#define MAX_N 20
int N, counter, res = INF, A[MAX_N], B[MAX_N], P[MAX_N];
signed main() {
cin >> N;
rep(i, N) cin >> A[i] >> B[i], B[i] -= A[i];
rep(i, N) P[i] = i;
do {
counter = 0;
rep(i, N - 1) counter = max(counter, B[P[i]] + A[P[i + 1]]);
res = min(res, counter);
} while (next_permutation(P, P + N));
cout << res << endl;
}