結果
| 問題 |
No.707 書道
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-15 13:22:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 707 bytes |
| コンパイル時間 | 2,543 ms |
| コンパイル使用メモリ | 195,448 KB |
| 最終ジャッジ日時 | 2025-01-09 06:56:27 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 2 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::vector<std::pair<double,double>>a;
lint h,w;std::cin>>h>>w;
for(lint i=1;i<=h;i++){
for(lint j=1;j<=w;j++){
char c;std::cin>>c;
if(c=='1')a.emplace_back(i,j);
}
}
double ans=std::numeric_limits<double>::infinity();
for(lint i=0;i<=h+1;i++){
for(lint j=0;j<=w+1;j++){
if((1<=i&&i<=h)==(1<=j&&j<=w))continue;
double now=0;
for(auto[x,y]:a){
now+=std::hypot(x-i,y-j);
}
if(now<ans)ans=now;
}
}
std::cout<<ans<<'\n';
}
ngtkana