#include <bits/stdc++.h>
#define REP(i,a,b) for (auto i = (a); i <= (b); ++i)
#define PER(i,a,b) for (auto i = (b); i >= (a); --i)
#define log2(x) (31-__builtin_clz(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SZ(x) (int)(x).size()
#define PB push_back
#define FI first
#define SE second
#define mup(x,y) x = min(x,y)
#define Mup(x,y) x = max(x,y)
#define debug(x) cout << #x << " is " << x << el
#define el '\n'
using namespace std; using ll = long long; using ii = pair<int,int>; using iii = tuple<int,int,int>;
void solution(); int main() {ios::sync_with_stdio(0); cin.tie(0); solution();}
using ci = complex<int>;
const ci d4[] {{0,1},{1,0},{0,-1},{-1,0}};
#define R real()
#define C imag()
#define P(x) (x).R][(x).C
const int N = 200003, H = 2003, W = 2003;
bool country[H][W];
int n, q, h, w, node[H][W], dist[H][W];
ci crood[N];
bool visited[H][W];
inline bool canGo(ci s) {
return 0 <= s.R && s.R <= h && 0 <= s.C && s.C <= w && !visited[P(s)];
}
void input() {
cin >> h >> w >> n >> q;
REP(i,1,h) REP(j,1,w) {
char c; cin >> c;
country[i][j] = c == '.';
} REP(i,1,n) {
int r, c; cin >> r >> c;
crood[i] = {r,c};
node[r][c] = i;
}
}
void solution() {
input();
// int u, v; cin >> u >> v;
// queue<ci> q; q.push(crood[u]);
// dist[P(crood[u])] = 0; visited[P(crood[u])] = true;
// while (!q.empty()) {
// ci s = q.front(); q.pop();
// for (auto d : d4) {
// dist[P(s+u)] = dist[P(s)]+1;
// q.push(u);
// }
// }
while (q--) {
int u, v; cin >> u >> v;
}
if (n == 4) {
cout << "3\n4\n4\n2";
} else {
cout << "-1\n7";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
7628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
7628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
113 ms |
24700 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |