Submission #00059
ソースコード
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #include<bits/stdc++.h> using namespace std; int main() { int h,w,a[30][30],doro=0,max1=0,max2=0,h2,w2,ans=0,su,ni,doro2; cin>>h>>w; for ( int i=0;i<h;i++){ for ( int j=0;j<w;j++){ cin>>a[i][j]; } } for ( int j=0;j<w;j++){ for ( int i=0;i<h;i++){ doro=doro+a[i][j]; if (doro>max2){ w2=j; doro2=max2; max2=doro; } } doro=0; doro2=0; } cout<<max2<< "\n" ; for ( int i=0;i<h;i++){ for ( int j=0;j<w;j++){ doro=doro+a[i][j]; if (j==w2){ doro=doro-a[i][j]; } if (doro>max1){ h2=i; doro2=max1; max1=doro; } } doro=0; } cout<<max1<< "\n" ; for ( int i=0;i<h;i++){ for ( int j=0;j<w;j++){ su=h2-i; ni=w2-j; if (su<0){ su=su*-1; } if (ni<0){ ni=ni*-1; } if (i!=h2&&j!=w2){ ans=ans+a[i][j]; if (su>1&&ni>1){ if (su>ni){ ans=ans+a[i][j]*(ni-1); } else { ans=ans+a[i][j]*(su-1); } } } } } cout<<ans<< "\n" ; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - 幹線道路 (Trunk Road) |
ユーザー名 | ei1828 |
投稿日時 | 2018-11-21 19:22:07 |
言語 | C++ |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 1045 Byte |
最大実行時間 | 31 ms |
最大メモリ使用量 | 620 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
01-01.txt | WA | 23 ms | 476 KB |
1
|
01-02.txt | WA | 17 ms | 448 KB |
1
|
01-03.txt | WA | 18 ms | 544 KB |
1
|
01-04.txt | WA | 24 ms | 508 KB |
1
|
01-05.txt | WA | 24 ms | 480 KB |
1
|
02-01.txt | WA | 22 ms | 452 KB |
1
|
02-02.txt | WA | 31 ms | 424 KB |
1
|
02-03.txt | WA | 20 ms | 524 KB |
1
|
02-04.txt | WA | 25 ms | 620 KB |
1
|
02-05.txt | WA | 18 ms | 592 KB |
1
|
02-06.txt | WA | 22 ms | 560 KB |
1
|
02-07.txt | WA | 23 ms | 532 KB |
1
|
02-08.txt | WA | 21 ms | 500 KB |
1
|
02-09.txt | WA | 23 ms | 600 KB |
1
|
02-10.txt | WA | 25 ms | 576 KB |
1
|
02-11.txt | WA | 28 ms | 544 KB |
1
|
02-12.txt | WA | 21 ms | 392 KB |
1
|
02-13.txt | WA | 19 ms | 496 KB |
1
|
02-14.txt | WA | 28 ms | 468 KB |
1
|
sample-01.txt | WA | 29 ms | 440 KB |
1
|
sample-02.txt | WA | 22 ms | 540 KB |
1
|