結果

問題 No.2094 Symmetry
ユーザー 👑 NachiaNachia
提出日時 2022-10-07 21:36:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,165 bytes
コンパイル時間 1,064 ms
コンパイル使用メモリ 84,456 KB
実行使用メモリ 6,088 KB
最終ジャッジ日時 2023-09-03 00:42:14
合計ジャッジ時間 4,282 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 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,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 64 ms
6,012 KB
testcase_10 AC 63 ms
5,932 KB
testcase_11 AC 64 ms
5,940 KB
testcase_12 AC 63 ms
6,008 KB
testcase_13 AC 64 ms
5,944 KB
testcase_14 AC 64 ms
6,008 KB
testcase_15 AC 63 ms
6,016 KB
testcase_16 AC 63 ms
5,948 KB
testcase_17 AC 63 ms
6,004 KB
testcase_18 AC 63 ms
6,012 KB
testcase_19 AC 64 ms
5,944 KB
testcase_20 AC 63 ms
5,924 KB
testcase_21 AC 64 ms
5,924 KB
testcase_22 AC 64 ms
5,940 KB
testcase_23 AC 63 ms
5,944 KB
testcase_24 AC 64 ms
5,952 KB
testcase_25 AC 62 ms
5,952 KB
testcase_26 AC 63 ms
6,000 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 37 ms
5,944 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 39 ms
5,952 KB
testcase_31 AC 37 ms
6,088 KB
testcase_32 AC 39 ms
5,940 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 31 ms
5,924 KB
testcase_35 AC 26 ms
5,952 KB
testcase_36 AC 31 ms
5,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <deque>
#include <atcoder/modint>

using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;

int main(){
    int N; cin >> N;
    i64 K; cin >> K;
    int Bcnt = 0;
    rep(i,N*2){ string s; cin >> s; for(char c : s) if(c == '#') Bcnt++; }
    vector<i64> C(N*N*4);
    vector<i64> C2(N*N*2);
    rep(i,2*N) rep(j,2*N){
        int c; cin >> c;
        C[2*N*i+j] += c;
        C2[N*i+min(j,2*N-1-j)] += c;
    }
    sort(C.begin(), C.end(), greater<i64>());
    sort(C2.begin(), C2.end(), greater<i64>());
    i64 ans1 = 0;
    rep(i,Bcnt) ans1 += C[i];
    if(Bcnt % 2 == 0){
        i64 ans2 = K;
        rep(i,Bcnt/2) ans2 += C2[i];
        ans1 = max(ans1, ans2);
    }
    cout << ans1 << endl;
    return 0;
}


struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;


0