結果
| 問題 |
No.2094 Symmetry
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2022-10-07 21:36:02 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 1,165 bytes |
| コンパイル時間 | 2,400 ms |
| コンパイル使用メモリ | 120,388 KB |
| 最終ジャッジ日時 | 2025-02-07 23:00:00 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#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;
Nachia