結果
| 問題 | No.3697 実力を揃える |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-13 10:35:20 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 715 bytes |
| 記録 | |
| コンパイル時間 | 4,932 ms |
| コンパイル使用メモリ | 357,708 KB |
| 実行使用メモリ | 20,076 KB |
| 最終ジャッジ日時 | 2026-09-13 10:35:32 |
| 合計ジャッジ時間 | 7,332 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int N;
cin >> N;
vector<ll> A(N);
for (ll& x : A) cin >> x;
int M = N/2;
vector<ll> L(A.begin(), A.begin()+M);
vector<ll> R(A.begin()+M, A.end());
vector<ll> LS, RS;
for (int bit = 0; bit < (1<<M); bit++){
ll ls = 0, rs = 0;
for (int i = 0; i < M; i++){
if (bit>>i&1) ls += L[i], rs += R[i];
}
LS.push_back(ls);
RS.push_back(rs);
}
ll S = reduce(A.begin(), A.end());
ll res = 0;
for (int x : LS){
auto it = upper_bound(RS.begin(), RS.end(), S/2-x)-1;
res = max(res, x+*it);
}
cout << S-2*res << endl;
}