Submission #00002


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
int main()
{
int H, W;
int a[30][30];
cin >> H >> W;
for (int i= 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
cin >> a[i][j];
}
}
int ans = INT_MAX;
for (int y=0; y < H; ++y) {
for (int x=0; x < W; ++x) {
int sum = 0;
for (int i = 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
sum += a[i][j] * min(abs(y-i), abs(x-j));
}
}
ans = min(ans, sum);
}
}
cout << ans << endl;
}

ステータス

項目 データ
問題 0002 - 部活のスケジュール表 (Schedule)
ユーザー名 403号室
投稿日時 2018-11-06 21:30:21
言語 C++14
状態 Wrong Answer
得点 0
ソースコード長 640 Byte
最大実行時間 52 ms
最大メモリ使用量 708 KB

セット

セット 得点 Cases
1 入力1 0 / 20 *1.txt
2 入力2 0 / 20 *[12].txt
3 入力3 0 / 20 *[1-3].txt
4 入力4 0 / 20 *[1-4].txt
5 入力5 0 / 20 *[1-5].txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
2014-yo-t4-in1.txt WA 52 ms 604 KB
1
2
3
4
5
2014-yo-t4-in2.txt WA 23 ms 708 KB
2
3
4
5
2014-yo-t4-in3.txt WA 23 ms 680 KB
3
4
5
2014-yo-t4-in4.txt WA 30 ms 648 KB
4
5
2014-yo-t4-in5.txt WA 30 ms 624 KB
5