Submission #598315

#TimeUsernameProblemLanguageResultExecution timeMemory
598315nguyen31hoang08minh2003Pohlepko (COCI16_pohlepko)C++14
80 / 80
14 ms16368 KiB
/* =/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\= //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// =\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/= \==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/ \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// -//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\- //----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\ \\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----// -\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//- //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ /==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\ =/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\= //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// =\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/= \==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/ \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// -//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\- //----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\//----\\ \\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----//\\----// -\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//--\\--//- //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ /==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\ =/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\==/\= //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// =\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/==\/= */ #include <bits/stdc++.h> #define fore(i, a, b) for (int i = (a), i##_last = (b); i < i##_last; ++i) #define fort(i, a, b) for (int i = (a), i##_last = (b); i <= i##_last; ++i) #define ford(i, a, b) for (int i = (a), i##_last = (b); i >= i##_last; --i) #define fi first #define se second #define pb push_back #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ll = long long; using ld = long double; template<class A, class B> bool maxi(A &a, const B &b) {return (a < b) ? (a = b, true):false;}; template<class A, class B> bool mini(A &a, const B &b) {return (a > b) ? (a = b, true):false;}; typedef unsigned long long ull; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef vector<vii> vvii; #define maxN 2005 #define maxM 2005 const int inf = 0x3f3f3f3f; const short directions[2][2] = {{0, 1}, {1, 0} }; int n, m; string board[maxN]; short trace[maxN][maxM]; void input() { cin >> n >> m; fore(x, 0, n) cin >> board[x]; } void solve() { vii q[2]; string result; q[0].emplace_back(0, 0); memset(trace, -1, sizeof(trace)); for (int c, flag = 0, u, v; !q[flag].empty(); flag ^= 1) { c = inf; for (const auto &[x, y] : q[flag]) for (const auto &[dx, dy] : directions) { u = dx + x; v = dy + y; if (u >= n || v >= m) continue; mini(c, board[u][v]); } for (const auto &[x, y] : q[flag]) fort(d, 0, 1) { const auto &[dx, dy] = directions[d]; u = dx + x; v = dy + y; if (u >= n || v >= m || c != board[u][v] || trace[u][v] >= 0) continue; trace[u][v] = d; q[flag ^ 1].emplace_back(u, v); } q[flag].clear(); } for (int x = n - 1, y = m - 1; x > 0 || y > 0;) { const int &d = trace[x][y]; result += board[x][y]; x -= directions[d][0]; y -= directions[d][1]; } result += board[0][0]; reverse(all(result)); cout << result << '\n'; } int main() { #ifdef LOCAL freopen("input.INP", "r", stdin); #endif // LOCAL cin.tie(0) -> sync_with_stdio(0); cout.tie(0); input(); solve(); return 0; }

Compilation message (stderr)

pohlepko.cpp: In function 'void solve()':
pohlepko.cpp:78:26: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   78 |         for (const auto &[x, y] : q[flag])
      |                          ^
pohlepko.cpp:79:30: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   79 |             for (const auto &[dx, dy] : directions) {
      |                              ^
pohlepko.cpp:86:26: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   86 |         for (const auto &[x, y] : q[flag])
      |                          ^
pohlepko.cpp:88:29: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   88 |                 const auto &[dx, dy] = directions[d];
      |                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...