結果
問題 |
No.2856 Junk Market Game
|
ユーザー |
|
提出日時 | 2024-08-25 14:10:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 620 bytes |
コンパイル時間 | 2,007 ms |
コンパイル使用メモリ | 200,784 KB |
最終ジャッジ日時 | 2025-02-24 01:05:43 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 50 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; N *= 2; vector<int> A(N),B(N); for(auto &a : A) cin >> a; for(auto &b : B) cin >> b; vector<int> P(N); for(int i=0; i<N; i++) P.at(i) = i; sort(P.begin(),P.end(),[&](auto &a,auto &b){ return max(A.at(a),B.at(a))<max(A.at(b),B.at(b)); }); long long answer = 0; for(int i=0; i<N;){ int p = P.at(i); i++; answer += A.at(p); p = P.at(i); i++; answer -= B.at(p); } cout << answer << endl; }