Submission #495680

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4956802021-12-20 01:35:52chenwzMecho (IOI09_mecho)C++14
100 / 100
229 ms22436 KiB
#include <bits/stdc++.h>
using namespace std;
const int NN = 2000 + 4, DX[4] = {1, -1, 0, 0}, DY[4] = {0, 0, 1, -1};
#define _for(i, a, b) for (int i = (a); i < (int)(b); ++i)
char G[NN][NN];
int N, S, B[NN][NN];
bool Vis[NN][NN];
struct Point {
int x, y;
};
bool check(const Point& st, int delay) {
if (delay * S >= B[st.x][st.y]) return false;
memset(Vis, 0, sizeof(Vis));
queue<pair<int, Point> > Q;
Q.push({delay * S, st}), Vis[st.x][st.y] = true;
while (!Q.empty()) {
auto p = Q.front();
Q.pop();
int d = p.first, x = p.second.x, y = p.second.y;
if (G[x][y] == 'D') return true;
_for(i, 0, 4) {
int nx = x + DX[i], ny = y + DY[i];
if (nx < 0 || nx >= N || ny < 0 || ny >= N || G[nx][ny] == 'T' ||
(d + 1) >= B[nx][ny] || Vis[nx][ny])
continue;
Q.push({d + 1, {nx, ny}}), Vis[nx][ny] = true;
}
}
return false;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

mecho.cpp: In function 'int main()':
mecho.cpp:57:21: warning: 'Home.Point::x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   57 |   B[Home.x][Home.y] = N * N * S;
      |   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
mecho.cpp:57:21: warning: 'Home.Point::y' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...