Submission #03661
ソースコード
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 | #include<bits/stdc++.h> using namespace std; int h, w, mp[50][50], n, mv[101]; int x, y; int dx[] = {0, 0, 1, -1}; int dy[] = {-1, 1, 0, 0}; int main(){ cin >> h >> w; for ( int i = 0; i < h; i++){ for ( int j = 0; j < w; j++){ cin >> mp[i][j]; if (mp[i][j] == 4){ x = j; y = i; } } } cin >> n; for ( int i = 0; i < n; i++) cin >> mv[i]; int yaku = 0; for ( int i = 0; i < n; i++){ while (1){ x += dx[mv[i]-1]; y += dy[mv[i]-1]; if (mp[y][x] == 1){ x -= dx[mv[i]-1]; y -= dy[mv[i]-1]; break ; } if (mp[y][x] == 3){ mp[y][x] = 0; yaku++; } } } cout << yaku << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0387 - 回れ雛月花 -Easy |
ユーザー名 | ei1409 |
投稿日時 | 2016-04-28 17:48:36 |
言語 | C++11 |
状態 | Accepted |
得点 | 3 |
ソースコード長 | 694 Byte |
最大実行時間 | 48 ms |
最大メモリ使用量 | 704 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
spin_input01 | AC | 10 ms | 476 KB |
1
|
spin_input02 | AC | 10 ms | 704 KB |
1
|
spin_input03 | AC | 17 ms | 548 KB |
1
|
spin_input04 | AC | 48 ms | 520 KB |
1
|
spin_input05 | AC | 14 ms | 488 KB |
1
|