結果
問題 | No.1467 Selling Cars |
ユーザー | QCFium |
提出日時 | 2021-03-17 17:11:13 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,004 bytes |
コンパイル時間 | 4,648 ms |
コンパイル使用メモリ | 252,340 KB |
実行使用メモリ | 19,288 KB |
最終ジャッジ日時 | 2024-04-27 08:07:30 |
合計ジャッジ時間 | 15,864 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> int ri() { int n; scanf("%d", &n); return n; } int main() { int m = ri(); int n = ri(); std::vector<int> a(m); std::vector<int> b(n); for (auto &i : a) i = ri(); for (auto &i : b) i = ri(); std::vector<std::pair<int, int> > seq; for (int j = 0; j < m; j++) seq.push_back({a[j], j + 1}); for (int j = 0; j < n; j++) seq.push_back({b[j], j + m + 1}); std::sort(seq.begin(), seq.end()); for (int i = 1; i <= m; i++) { atcoder::mcf_graph<int, int64_t> graph(n + m + 2); for (int j = 0; j < m; j++) graph.add_edge(0, j + 1, 1, 0); for (int j = 0; j < n; j++) graph.add_edge(j + m + 1, n + m + 1, i, 0); for (int j = 0; j + 1 < (int) seq.size(); j++) { graph.add_edge(seq[j].second, seq[j + 1].second, 1000000000, seq[j + 1].first - seq[j].first); graph.add_edge(seq[j + 1].second, seq[j].second, 1000000000, seq[j + 1].first - seq[j].first); } printf("%" PRId64 "\n", graph.flow(0, n + m + 1).second); } return 0; }