답안 #813449

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
813449 2023-08-07T18:02:56 Z birthdaycake Tracks in the Snow (BOI13_tracks) C++14
2.1875 / 100
2000 ms 412116 KB
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
 
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
 
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
 
 
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#define endl '\n'
#define int long long
#define mod 1000000007
using namespace std;

char m[4001][4001];
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
int dist[4001][4001];
signed main(){
    
    
    int h,w, ans = 0; cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> m[i][j];
        }
    }
    dist[0][0] = 1;
    priority_queue<pair<int,pair<int,int>>>d;
    d.push({-1,{0,0}});
    while(d.size()){
        auto x = d.top();
        ans = max(ans, x.first * -1);
        d.pop();
        for(int i = 0; i < 4; i++){
            int aa = x.second.first + dx[i], bb = x.second.second + dy[i];
            int val = dist[x.second.first][x.second.second] * -1;
            if(aa < 0 or bb < 0 or aa >= h or bb >= w) continue;
            if(m[aa][bb] == '.' or dist[aa][bb] != 0) continue;
            if(m[aa][bb] != m[x.second.first][x.second.second]) val++;
            dist[aa][bb] = val;
            d.push({-dist[aa][bb], {aa,bb}});
        }
    }
    
    cout << ans;
    
    
    
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2061 ms 2388 KB Time limit exceeded
2 Incorrect 1 ms 436 KB Output isn't correct
3 Execution timed out 2077 ms 394700 KB Time limit exceeded
4 Execution timed out 2064 ms 396612 KB Time limit exceeded
5 Execution timed out 2076 ms 1492 KB Time limit exceeded
6 Incorrect 1 ms 468 KB Output isn't correct
7 Execution timed out 2066 ms 394668 KB Time limit exceeded
8 Execution timed out 2076 ms 197564 KB Time limit exceeded
9 Execution timed out 2051 ms 197900 KB Time limit exceeded
10 Execution timed out 2068 ms 1492 KB Time limit exceeded
11 Execution timed out 2092 ms 395248 KB Time limit exceeded
12 Execution timed out 2067 ms 1456 KB Time limit exceeded
13 Execution timed out 2071 ms 1492 KB Time limit exceeded
14 Execution timed out 2063 ms 1496 KB Time limit exceeded
15 Execution timed out 2075 ms 199660 KB Time limit exceeded
16 Execution timed out 2053 ms 2444 KB Time limit exceeded
17 Execution timed out 2075 ms 2388 KB Time limit exceeded
18 Execution timed out 2076 ms 396536 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2065 ms 227872 KB Time limit exceeded
2 Execution timed out 2065 ms 203504 KB Time limit exceeded
3 Execution timed out 2058 ms 18712 KB Time limit exceeded
4 Execution timed out 2055 ms 207148 KB Time limit exceeded
5 Incorrect 477 ms 65100 KB Output isn't correct
6 Execution timed out 2028 ms 399216 KB Time limit exceeded
7 Execution timed out 2081 ms 32212 KB Time limit exceeded
8 Execution timed out 2082 ms 227824 KB Time limit exceeded
9 Execution timed out 2074 ms 197696 KB Time limit exceeded
10 Execution timed out 2079 ms 340 KB Time limit exceeded
11 Execution timed out 2076 ms 228772 KB Time limit exceeded
12 Incorrect 2 ms 1620 KB Output isn't correct
13 Execution timed out 2087 ms 203460 KB Time limit exceeded
14 Execution timed out 2041 ms 5196 KB Time limit exceeded
15 Execution timed out 2086 ms 206372 KB Time limit exceeded
16 Execution timed out 2081 ms 199776 KB Time limit exceeded
17 Execution timed out 2057 ms 10416 KB Time limit exceeded
18 Execution timed out 2051 ms 215360 KB Time limit exceeded
19 Execution timed out 2072 ms 207068 KB Time limit exceeded
20 Execution timed out 2066 ms 206056 KB Time limit exceeded
21 Execution timed out 2101 ms 15208 KB Time limit exceeded
22 Incorrect 455 ms 65172 KB Output isn't correct
23 Execution timed out 2021 ms 12284 KB Time limit exceeded
24 Execution timed out 2076 ms 27856 KB Time limit exceeded
25 Execution timed out 2079 ms 34984 KB Time limit exceeded
26 Correct 1551 ms 125744 KB Output is correct
27 Execution timed out 2047 ms 412012 KB Time limit exceeded
28 Execution timed out 2013 ms 411868 KB Time limit exceeded
29 Execution timed out 2070 ms 17704 KB Time limit exceeded
30 Execution timed out 2050 ms 411696 KB Time limit exceeded
31 Execution timed out 2092 ms 212464 KB Time limit exceeded
32 Execution timed out 2033 ms 412116 KB Time limit exceeded