Submission #00084


ソースコード

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
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
char drug[1005][1005];
int h, w;
int yh, yw;
int ans = 0;
cin >> h >> w;
cin >> yh >> yw;
for (int i = 0; i < yh; i++) {
for (int j = 0; j < yw; j++) {
cin >> drug[i][j];
}
}
for (int i = yh - 1; i >= 0; i--) {
for (int j = 0; j < yw; j++) {
int y = i;
while (y >= 0 && y < yh &&
j >= 0 && j < yw &&
drug[y][j] == '#' &&
drug[y + 1][j] == '.') {
swap(drug[y + 1][j], drug[y][j]);
y++;
}
}
}
for (int i = yh - 1; i >= max(yh - h, 0); i--) {
for (int j = 0; j < w; j++) {
if (drug[i][j] == '#') {
ans++;
}
}
}
cout << ans << endl;
return 0;
}

ステータス

項目 データ
問題 0003 - 雛ちゃんとふろー
ユーザー名 ei1710
投稿日時 2018-08-22 11:34:33
言語 C++14
状態 Accepted
得点 10
ソースコード長 983 Byte
最大実行時間 72 ms
最大メモリ使用量 1640 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 23 ms 1248 KB
1
Input02 AC 72 ms 1328 KB
1
Input03 AC 20 ms 528 KB
1
Input04 AC 30 ms 576 KB
1
Input05 AC 38 ms 760 KB
1
Input06 AC 18 ms 948 KB
1
Input07 AC 23 ms 1012 KB
1
Input08 AC 48 ms 1212 KB
1
Input09 AC 39 ms 1292 KB
1
Input10 AC 23 ms 596 KB
1
Input11 AC 25 ms 640 KB
1
Input12 AC 30 ms 820 KB
1
Input13 AC 37 ms 868 KB
1
Input14 AC 30 ms 1052 KB
1
Input15 AC 48 ms 1240 KB
1
Input16 AC 20 ms 1440 KB
1
Input17 AC 34 ms 1640 KB
1
Input18 AC 22 ms 824 KB
1
Input19 AC 30 ms 872 KB
1
Input20 AC 18 ms 1176 KB
1