結果
問題 | No.909 たぴの配置 |
ユーザー | nayuta |
提出日時 | 2019-10-18 22:02:56 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 384 ms / 3,000 ms |
コード長 | 778 bytes |
コンパイル時間 | 1,752 ms |
コンパイル使用メモリ | 178,844 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2023-09-07 23:32:08 |
合計ジャッジ時間 | 8,304 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,436 KB |
testcase_01 | AC | 2 ms
5,432 KB |
testcase_02 | AC | 2 ms
5,484 KB |
testcase_03 | AC | 2 ms
5,476 KB |
testcase_04 | AC | 2 ms
5,420 KB |
testcase_05 | AC | 367 ms
10,616 KB |
testcase_06 | AC | 378 ms
11,444 KB |
testcase_07 | AC | 354 ms
11,076 KB |
testcase_08 | AC | 375 ms
10,956 KB |
testcase_09 | AC | 384 ms
11,076 KB |
testcase_10 | AC | 364 ms
11,052 KB |
testcase_11 | AC | 352 ms
12,032 KB |
testcase_12 | AC | 373 ms
11,384 KB |
testcase_13 | AC | 380 ms
11,092 KB |
testcase_14 | AC | 366 ms
10,608 KB |
testcase_15 | AC | 377 ms
10,888 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; int N; long long int X[201010], Y[201010]; vector<tuple<int, int, int, int>> tp; long long int ans = 1e18, p[201010]; int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> X[i]; } for (int i = 0; i < N; i++) { cin >> Y[i]; } for (int i = 0; i < N; i++) { tp.emplace_back(X[i] + Y[i], X[i], Y[i], i); } sort(tp.begin(), tp.end()); long long int sum, x, y, id; for (int i = 0; i < N; i++) { tie(sum, x, y, id) = tp[i]; if (sum < ans) { ans = sum; } if (x >= ans) { p[id] = ans; } else { p[id] = x; } } cout << ans << endl; cout << 0 << endl; for (int i = 0; i < N; i++) { cout << p[i] << endl; } cout << ans << endl; return 0; }