Submission #00047


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
int h,w;
int a[26][26];
cin>>h>>w;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>a[i][j];
}
}
int mh,mw;
long long sum[26][26];
memset(sum,0,sizeof(sum));
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
for(int l=0;l<h;l++){
for(int k=0;k<w;k++){
if(l-j<0)mh=-1*(l-j);
else mh=l-j;
if(k-i<0)mw=-1*(k-i);
else mw=k-i;
sum[i][j]+=a[l][k]*min(mh,mw);
}
}
}
}
long long min=1000000000;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(min>sum[i][j])min=sum[i][j];
}
}
cout<<min<<"\n";
return 0;
}

ステータス

項目 データ
問題 0003 - 幹線道路 (Trunk Road)
ユーザー名 ei1832
投稿日時 2018-11-21 18:43:07
言語 C++
状態 Wrong Answer
得点 0
ソースコード長 713 Byte
最大実行時間 29 ms
最大メモリ使用量 668 KB

セット

セット 得点 Cases
1 ALL 0 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 22 ms 604 KB
1
01-02.txt AC 20 ms 576 KB
1
01-03.txt AC 20 ms 544 KB
1
01-04.txt AC 17 ms 388 KB
1
01-05.txt AC 19 ms 484 KB
1
02-01.txt AC 18 ms 580 KB
1
02-02.txt AC 22 ms 544 KB
1
02-03.txt WA 18 ms 504 KB
1
02-04.txt WA 22 ms 472 KB
1
02-05.txt AC 21 ms 444 KB
1
02-06.txt AC 18 ms 668 KB
1
02-07.txt AC 29 ms 636 KB
1
02-08.txt AC 24 ms 596 KB
1
02-09.txt AC 21 ms 568 KB
1
02-10.txt AC 22 ms 664 KB
1
02-11.txt AC 23 ms 636 KB
1
02-12.txt AC 29 ms 608 KB
1
02-13.txt AC 19 ms 584 KB
1
02-14.txt AC 22 ms 556 KB
1
sample-01.txt AC 23 ms 652 KB
1
sample-02.txt AC 21 ms 500 KB
1