結果
問題 |
No.2856 Junk Market Game
|
ユーザー |
![]() |
提出日時 | 2024-08-25 13:51:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 3,524 ms |
コンパイル使用メモリ | 255,472 KB |
最終ジャッジ日時 | 2025-02-24 00:59:53 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int n; cin>>n; n *= 2; vector<long long> a(n),b(n); rep(i,n)cin>>a[i]; rep(i,n)cin>>b[i]; long long ans = 0; vector<long long> t; rep(i,n){ ans += a[i]; t.push_back(-b[i]-a[i]); } sort(t.rbegin(),t.rend()); rep(i,n){ if(i%2==1)ans += t[i]; } cout<<ans<<endl; return 0; }