답안 #438483

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
438483 2021-06-28T05:49:26 Z zeyu Tracks in the Snow (BOI13_tracks) C++17
2.1875 / 100
89 ms 80720 KB
#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<string> graph(n);
	for (int i = 0; i < n; i ++) cin >> graph[i];
	int cnt[n][m];
	int inf = 0x3f3f3f3f;
	memset(cnt, inf, sizeof(cnt));
	cnt[0][0] = 1;
	queue<pair<int, int> > que;
	que.push(make_pair(0, 0));
	while(! que.empty()){
		pair<int, int> p = que.front();
		que.pop();
		for (int i = 0; i < 4; i ++){
			int x = p.first + dx[i];
			int y = p.second + dy[i];
			if (x >= 0 && x < n && y >= 0 && y < m && cnt[x][y] > cnt[p.first][p.second] + (graph[x][y] != graph[p.first][p.second] && (graph[x][y] == 'R' || graph[x][y] == 'F'))){
				que.push(make_pair(x, y));
				cnt[p.first][p.second] += graph[x][y] != graph[p.first][p.second];
			}
		}
	}
	int ans = inf;
	for (int i = 0; i < n; i ++){
		for (int j = 0; j < m; j ++) ans = min(ans, cnt[i][j]);
	}
	cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1484 KB Output isn't correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 1 ms 972 KB Output isn't correct
5 Incorrect 1 ms 716 KB Output isn't correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Incorrect 1 ms 332 KB Output isn't correct
10 Incorrect 1 ms 588 KB Output isn't correct
11 Incorrect 1 ms 460 KB Output isn't correct
12 Incorrect 1 ms 716 KB Output isn't correct
13 Incorrect 1 ms 716 KB Output isn't correct
14 Incorrect 1 ms 716 KB Output isn't correct
15 Incorrect 2 ms 1484 KB Output isn't correct
16 Incorrect 2 ms 1484 KB Output isn't correct
17 Incorrect 2 ms 1484 KB Output isn't correct
18 Incorrect 2 ms 972 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 588 KB Output isn't correct
2 Incorrect 9 ms 8012 KB Output isn't correct
3 Incorrect 89 ms 80596 KB Output isn't correct
4 Incorrect 22 ms 18984 KB Output isn't correct
5 Incorrect 49 ms 45296 KB Output isn't correct
6 Incorrect 86 ms 80708 KB Output isn't correct
7 Incorrect 1 ms 588 KB Output isn't correct
8 Incorrect 1 ms 588 KB Output isn't correct
9 Incorrect 1 ms 588 KB Output isn't correct
10 Incorrect 1 ms 460 KB Output isn't correct
11 Incorrect 1 ms 588 KB Output isn't correct
12 Incorrect 1 ms 332 KB Output isn't correct
13 Incorrect 9 ms 8012 KB Output isn't correct
14 Incorrect 7 ms 4812 KB Output isn't correct
15 Incorrect 6 ms 5292 KB Output isn't correct
16 Incorrect 4 ms 3404 KB Output isn't correct
17 Incorrect 23 ms 20452 KB Output isn't correct
18 Incorrect 22 ms 20224 KB Output isn't correct
19 Incorrect 21 ms 18940 KB Output isn't correct
20 Incorrect 19 ms 17460 KB Output isn't correct
21 Incorrect 61 ms 46848 KB Output isn't correct
22 Incorrect 47 ms 45332 KB Output isn't correct
23 Incorrect 42 ms 38988 KB Output isn't correct
24 Incorrect 48 ms 45636 KB Output isn't correct
25 Incorrect 84 ms 80696 KB Output isn't correct
26 Correct 69 ms 61688 KB Output is correct
27 Incorrect 89 ms 80720 KB Output isn't correct
28 Incorrect 84 ms 80696 KB Output isn't correct
29 Incorrect 84 ms 80708 KB Output isn't correct
30 Incorrect 84 ms 79044 KB Output isn't correct
31 Incorrect 53 ms 51580 KB Output isn't correct
32 Incorrect 84 ms 80704 KB Output isn't correct