結果

問題 No.2094 Symmetry
ユーザー _yurimoir_yurimoir
提出日時 2022-10-08 08:57:26
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 923 bytes
コンパイル時間 3,536 ms
コンパイル使用メモリ 255,472 KB
実行使用メモリ 8,288 KB
最終ジャッジ日時 2023-09-04 07:42:55
合計ジャッジ時間 10,720 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 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,376 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 148 ms
8,168 KB
testcase_10 AC 146 ms
7,732 KB
testcase_11 AC 147 ms
7,792 KB
testcase_12 AC 147 ms
7,800 KB
testcase_13 AC 146 ms
8,288 KB
testcase_14 AC 147 ms
7,740 KB
testcase_15 AC 146 ms
7,740 KB
testcase_16 AC 146 ms
8,192 KB
testcase_17 AC 147 ms
7,804 KB
testcase_18 AC 148 ms
7,792 KB
testcase_19 AC 148 ms
7,780 KB
testcase_20 AC 147 ms
7,924 KB
testcase_21 AC 148 ms
8,180 KB
testcase_22 AC 147 ms
8,176 KB
testcase_23 AC 148 ms
7,796 KB
testcase_24 AC 148 ms
7,912 KB
testcase_25 AC 147 ms
7,844 KB
testcase_26 AC 146 ms
7,792 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 124 ms
7,740 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 131 ms
7,788 KB
testcase_31 AC 126 ms
7,792 KB
testcase_32 AC 132 ms
7,732 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 95 ms
7,876 KB
testcase_35 AC 79 ms
7,848 KB
testcase_36 AC 76 ms
7,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n;
    ll k;
    cin>>n>>k;
    int cnt=0;
    for(int i=0;i<2*n;i++){
        for(int j=0;j<2*n;j++){
            char ch;
            cin>>ch;
            if(ch=='#')cnt++;
        }
    }
    ll c[2*n][2*n];
    vector<ll> clst(2*n*2*n,0);
    vector<ll> plst(2*n*n,0);
    for(int i=0;i<2*n;i++){
        for(int j=0;j<2*n;j++){
            cin>>c[i][j];
            clst[2*n*i+j]=c[i][j];
        }
    }
    for(int i=0;i<2*n;i++){
        for(int j=0;j<n;j++){
            plst[n*i+j]=c[i][j]+c[i][2*n-1-j];
        }
    }
    sort(clst.rbegin(),clst.rend());
    sort(plst.rbegin(),plst.rend());
    ll ans=0;
    for(int i=0;i<cnt;i++){
        ans+=clst[i];
    }
    if(cnt%2==0){
        ll sym=k;
        for(int i=0;i<cnt/2;i++){
            sym+=plst[i];
        }
        ans=max(ans,sym);
    }
    cout<<ans<<endl;
}
0