This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |