Submission #00048
ソースコード
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; int 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); } } } } int 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:45:50 |
言語 | C++ |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 701 Byte |
最大実行時間 | 30 ms |
最大メモリ使用量 | 668 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
01-01.txt | AC | 21 ms | 604 KB |
1
|
01-02.txt | AC | 20 ms | 580 KB |
1
|
01-03.txt | AC | 22 ms | 548 KB |
1
|
01-04.txt | AC | 22 ms | 648 KB |
1
|
01-05.txt | AC | 21 ms | 620 KB |
1
|
02-01.txt | AC | 27 ms | 464 KB |
1
|
02-02.txt | AC | 22 ms | 564 KB |
1
|
02-03.txt | WA | 17 ms | 540 KB |
1
|
02-04.txt | WA | 21 ms | 512 KB |
1
|
02-05.txt | AC | 22 ms | 484 KB |
1
|
02-06.txt | AC | 30 ms | 456 KB |
1
|
02-07.txt | AC | 20 ms | 556 KB |
1
|
02-08.txt | AC | 25 ms | 528 KB |
1
|
02-09.txt | AC | 25 ms | 504 KB |
1
|
02-10.txt | AC | 22 ms | 476 KB |
1
|
02-11.txt | AC | 28 ms | 448 KB |
1
|
02-12.txt | AC | 23 ms | 668 KB |
1
|
02-13.txt | AC | 19 ms | 508 KB |
1
|
02-14.txt | AC | 23 ms | 484 KB |
1
|
sample-01.txt | AC | 21 ms | 580 KB |
1
|
sample-02.txt | AC | 24 ms | 552 KB |
1
|