結果

問題 No.2094 Symmetry
ユーザー rogi52rogi52
提出日時 2022-10-07 21:46:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,000 bytes
コンパイル時間 2,259 ms
コンパイル使用メモリ 211,964 KB
実行使用メモリ 9,924 KB
最終ジャッジ日時 2023-09-03 01:18:02
合計ジャッジ時間 5,642 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 61 ms
9,372 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 61 ms
9,376 KB
testcase_18 AC 61 ms
9,492 KB
testcase_19 AC 63 ms
9,612 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 63 ms
9,604 KB
testcase_23 AC 62 ms
9,608 KB
testcase_24 AC 61 ms
9,436 KB
testcase_25 WA -
testcase_26 AC 63 ms
9,664 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 45 ms
9,744 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 48 ms
9,612 KB
testcase_31 AC 46 ms
9,668 KB
testcase_32 AC 47 ms
9,604 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 38 ms
9,616 KB
testcase_35 AC 33 ms
9,600 KB
testcase_36 AC 35 ms
9,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll N,K; cin >> N >> K;
    vector<string> S(2 * N);
    rep(i,2*N) cin >> S[i];
    vector<vector<ll>> C(2 * N, vector<ll>(2 * N));
    rep(i,2*N)rep(j,2*N) cin >> C[i][j];

    int cntB = 0;
    rep(i,2*N)rep(j,2*N) if(S[i][j] == '#') cntB++;
    ll ans1 = [N, C, cntB]() {
        vector<ll> V;
        rep(i,2*N)rep(j,2*N) V.push_back(C[i][j]);
        sort(V.rbegin(), V.rend());
        ll ans = 0;
        rep(i,cntB) ans += V[i];
        return ans;
    }();

    ll ans2 = [N, K, C, cntB]() {
        if(cntB % 2 == 1) return numeric_limits<ll>::min();
        vector<ll> V;
        rep(i,2*N)rep(j,N) V.push_back(C[i][j] + C[i][2 * N - 1 - j]);
        sort(V.rbegin(), V.rbegin());
        ll ans = 0;
        rep(i,cntB/2) ans += V[i];
        return ans + K;
    }();

    cout << max(ans1, ans2) << endl;
}
0