結果

問題 No.909 たぴの配置
ユーザー skentagonskentagon
提出日時 2019-10-18 22:00:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 464 ms / 3,000 ms
コード長 622 bytes
コンパイル時間 1,962 ms
コンパイル使用メモリ 173,404 KB
実行使用メモリ 14,928 KB
最終ジャッジ日時 2023-09-07 22:25:51
合計ジャッジ時間 9,336 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 443 ms
14,256 KB
testcase_06 AC 464 ms
14,928 KB
testcase_07 AC 425 ms
13,736 KB
testcase_08 AC 444 ms
14,272 KB
testcase_09 AC 456 ms
14,796 KB
testcase_10 AC 425 ms
13,892 KB
testcase_11 AC 426 ms
13,748 KB
testcase_12 AC 430 ms
14,408 KB
testcase_13 AC 458 ms
14,800 KB
testcase_14 AC 382 ms
13,820 KB
testcase_15 AC 409 ms
13,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for( int i=0; i<n; ++i )
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<vector<int>> d(n,vector<int>(3));
  vector<int> res(n);
  rep(i,n){ cin >> d[i][0]; }
  rep(i,n){ cin >> d[i][1]; }
  rep(i,n){ d[i][2] = i; }
  sort( d.begin(), d.end(), [](const vector<int>& l, const vector<int>& r){
    return l[0]+l[1] < r[0]+r[1];
  });
  auto ml = (*(d.begin()))[0] + (*(d.begin()))[1];
  cout << ml << endl;
  puts("0");
  rep(i,n){
    res[d[i][2]] = min( d[i][0], ml );
  }
  rep(i,n){
    cout << res[i] << endl;
  }
  cout << ml << endl;
}
0