# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
101416 | SomeoneUnknown | Tracks in the Snow (BOI13_tracks) | C++14 | 2071 ms | 213316 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
ii mii(int b, int c){
return make_pair(b,c);
}
iii miii(int a, int b, int c){
return make_pair(a, mii(b,c));
}
int main(){
//ios_base::sync_with_stdio(false);
int r, c;
//cin >> r >> c;
scanf("%d %d", &r, &c);
//string m[r];
char m[r][c+2];
for(int i = 0; i < r; i++){
//cin >> m[i];
//cout << "read";
scanf("%s", &m[i]);
}
priority_queue<iii> vable;
vable.push(miii(-1, 0, 0));
vable.push(miii(-1, r-1, c-1));
int most = 0;
while(!vable.empty()){
iii ving = vable.top();
vable.pop();
int y = ving.second.first;
int x = ving.second.second;
if(m[y][x] == '.') continue;
int a = ving.first;
most = max(most, -a);
if(y != r-1){
vable.push(miii(a-(m[y][x]!=m[y+1][x]), y+1, x));
}
if(x != c-1){
vable.push(miii(a-(m[y][x]!=m[y][x+1]), y, x+1));
}
if(y != 0){
vable.push(miii(a-(m[y][x]!=m[y-1][x]), y-1, x));
}
if(x != 0){
vable.push(miii(a-(m[y][x]!=m[y][x-1]), y, x-1));
}
m[y][x] = '.';
}
cout << most;//*/
}
/*
5 8
FFRF....
.FRRR...
.FFFFF..
..RRRFFR
.....FFF
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |