# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
837445 | Liudas | Soccer (JOI17_soccer) | C++17 | 385 ms | 27116 KiB |
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 int long long
using namespace std;
struct node{
int type;
int val;
int x, y;
bool operator<(const node & a)const{
return val > a.val;
}
};
signed main(){
int X, Y, A, B, C, N;
cin >> X >> Y >> A >> B >> C >> N;
vector<pair<int,int>> players(N);
vector<vector<int>> pos(X + 10, vector<int>(Y + 10, 1e9));
queue<array<int, 3>> populate;
for(int i = 0; i < N; i ++){
cin >> players[i].first >> players[i].second;
populate.push({players[i].first, players[i].second, 0});
}
while(!populate.empty()){
int x = populate.front()[0], y = populate.front()[1], c = populate.front()[2];
populate.pop();
if(pos[x][y] <= c)continue;
if(x > 0)populate.push({x - 1, y , c+ 1});
if(y > 0)populate.push({x, y-1, c+1});
if(x < X)populate.push({x + 1, y, c + 1});
if(y < Y)populate.push({x, y + 1, c + 1});
pos[x][y] = c;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |