제출 #1175685

#제출 시각아이디문제언어결과실행 시간메모리
1175685nagornzMecho (IOI09_mecho)C++20
4 / 100
5 ms1096 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast,unroll-loops,fast-math,unsafe-math-optimizations") #define int long long #define f first #define s second #define pii pair <int, int> #define iShowSpeed cin.tie(NULL)->sync_with_stdio(false) #define emb emplace_back using namespace std; const int inf = 1e14; const int mod = 998244353; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; bool can(int k, int n, int sx, int sy, int ex, int ey, vector <vector <int>> &bee, vector <vector <char>> &a, int mid) { queue <pii> q; q.emplace(sx, sy); vector <vector <int>> bear(n, vector <int> (n, inf)); bear[sx][sy] = 0; while (!q.empty()) { auto [x, y] = q.front(); q.pop(); for (int i = 0; i < 4; i++) { int nx = x + dx[i], ny = y + dy[i]; int dist = (bear[x][y]+1) / k; if (nx < 0 || nx >= n || ny < 0 || ny >= n || bear[nx][ny] != inf || dist + mid >= bee[nx][ny] || a[nx][ny] == 'T') continue; if (nx == ex && ny == ey) return true; bear[nx][ny] = bear[x][y]+1; q.emplace(nx, ny); } } return false; } int32_t main(){ iShowSpeed; int n, k; cin >> n >> k; vector <vector <char>> a(n, vector <char> (n)); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> a[i][j]; cout << -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...