| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1255319 | Mer123haba456 | Tracks in the Snow (BOI13_tracks) | C++20 | 2106 ms | 255964 KiB |
#include <bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define N lli(4005)
#define MOD lli(1e9 + 7)
#define heps(v) v.begin(), v.end()
typedef long long int lli;
typedef vector<lli> vlli;
typedef pair<lli, lli> plli;
typedef vector<plli> vplli;
typedef pair<lli, plli> pplli;
typedef vector<pplli> vpplli;
lli n,m,k,q,t;
vlli vect;
lli diz[N][N];
lli vis[4002][4002];
vplli yonler = {{0,1},{0,-1}, {1,0}, {-1,0}};
int main()
{
scanf("%lld %lld", &n, &m);
for(lli i = 1;i<=n;i++)
for(lli j = 1;j<=m;j++){
char c;
scanf(" %c", &c);
//cin >> c;
if(c == 'F')
diz[i][j] = 1;
else if(c == 'R')
diz[i][j] = 2;
}
priority_queue<pplli> Q;
Q.push({-1, {1,1}});
lli enb = 0;
while(!(Q.empty())){
pplli su = Q.top();
Q.pop();
if(vis[su.second.first][su.second.second])
continue;
vis[su.second.first][su.second.second] = 1;
enb = max(enb, -su.first);
for(plli yon : yonler){
lli x = su.second.first + yon.first;
lli y = su.second.second + yon.second;
if(vis[x][y])
continue;
if(!diz[x][y])
continue;
if(diz[x][y] == diz[su.second.first][su.second.second])
Q.push({su.first, {x,y}});
else
Q.push({su.first - 1, {x,y}});
}
}
printf("%lld", enb);
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
