結果
| 問題 | No.3558 Dominoes, Black and White |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-29 19:41:19 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,549 bytes |
| 記録 | |
| コンパイル時間 | 4,458 ms |
| コンパイル使用メモリ | 376,532 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-05-29 19:41:31 |
| 合計ジャッジ時間 | 7,174 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点 | 10 % | AC * 17 WA * 13 |
| 満点 | 90 % | AC * 22 WA * 67 |
| 合計 | 0 点 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define rall(v)v.rbegin(),v.rend()
using ll = long long;
using ull = unsigned long long;
#define iINF 2000000000
#define llINF 9000000000000000000ll
const int MOD9 = 998244353;
const int MOD1 = 1000000000 + 7;
const vector<int> dx = {0,1,0,-1} , dy = {1,0,-1,0};
//chmin , chmax
template<typename T>
bool chmin(T &a , T b){ if(a > b){a = b ; return 1;}return 0;}
template<typename T>
bool chmax(T &a , T b){ if(a < b){a = b ; return 1;}return 0;}
//io
template<typename T , typename F>
std::istream& operator>>(std::istream& is , pair<T,F> &p){
is >> p.first >> p.second; return is;
}
template<typename T , typename F>
std::ostream& operator<<(std::ostream& os , const pair<T,F> &p){
os << " [" << p.first << " , " << p.second << "] "; return os;
}
//vio
template<typename T>
void printv1(vector<T> &v){
for(int i=0;i<(int)v.size()-1;i++) cout << v[i] << " ";
cout << v.back() << "\n";
}
template<typename T>
void printv2(vector<T> & v){
for(auto &vi : v) cout << vi << "\n";
}
template<typename T>
void printvv(vector<vector<T>> &vv){
for(auto &vvi : vv) printv1(vvi);
}
template<typename T>
void printve1(vector<T> &v){
for(int i=0;i<(int)v.size()-1;i++) cerr << v[i] << " ";
cerr << v.back() << "\n";
}
template<typename T>
void printve2(vector<T> & v){
for(auto &vi : v) cerr << vi << "\n";
}
template<typename T>
void printvve(vector<vector<T>> &vv){
for(auto &vvi : vv) printve1(vvi);
}
template<typename T>
void vin(vector<T> &v){
for(auto &vi : v) cin >> vi;
}
template<typename T>
void vvin(vector<vector<T>> &vv){
for(auto &vvi : vv) vin(vvi);
}
#include <atcoder/all>
using namespace atcoder;
int main(){cin.tie(0);ios::sync_with_stdio(0);
int n;cin >> n;
vector<string> s(n);vin(s);
vector<int> cnt(n,0);
int ans = 0;
int cntsum = 0;
for(int i=0;i<n;i++){
for(int j=0;j<2*n;j++){
if(s[i][j] == '#') cnt[i]++;
}
cnt[i] = cnt[i] - n;
//cntsum += cnt[i];
int rigcnt = 0;
for(int j=2*n-1;j>=n;j--){
if(s[i][j] == '#'){
ans += 2 * n - 1 - j - rigcnt++;
}
}
for(int j=n-1;j>=0;j--){
if(s[i][j] == '#'){
ans += n;
}
}
}
//cout << ans << endl;
//cout << ans << endl;
int sum = cnt[0];
for(int i=1;i<n;i++){
ans += abs(sum);
sum += cnt[i];
}
cout << ans + n * cntsum << endl;
}