結果

問題 No.909 たぴの配置
ユーザー CleyLCleyL
提出日時 2019-10-18 21:51:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 405 ms / 3,000 ms
コード長 768 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 78,432 KB
実行使用メモリ 9,448 KB
最終ジャッジ日時 2023-09-07 21:56:37
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 399 ms
9,116 KB
testcase_06 AC 405 ms
9,432 KB
testcase_07 AC 367 ms
9,056 KB
testcase_08 AC 393 ms
9,128 KB
testcase_09 AC 389 ms
9,332 KB
testcase_10 AC 375 ms
9,244 KB
testcase_11 AC 367 ms
9,068 KB
testcase_12 AC 389 ms
9,080 KB
testcase_13 AC 404 ms
9,448 KB
testcase_14 AC 345 ms
9,036 KB
testcase_15 AC 374 ms
8,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> Paint;
int main(){
  int n;cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  vector<Paint> sm;
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  for(int i = 0; n > i; i++){
    cin>>b[i];
    sm.push_back({a[i]+b[i],i});
  }
  sort(sm.begin(),sm.end());
  vector<Paint> ans;
  for(int i = 0; n > i; i++){
    //0+a[sm[i].second]
    //sm[0].first-b[sm[i].second] ~ m[0].first+b[sm[i].second] 
    ans.push_back({sm[i].second,min(a[sm[i].second],sm[0].first+b[sm[i].second])});
  }
  sort(ans.begin(),ans.end());
  cout << sm[0].first << endl;
  cout << 0 << endl;
  for(int i = 0; n > i ;i++){
    cout << ans[i].second << endl;
  }
  cout << sm[0].first << endl;
}
0