Submission #465737

#TimeUsernameProblemLanguageResultExecution timeMemory
465737AmirElarbiPortals (BOI14_portals)C++14
0 / 100
1 ms460 KiB
#include <bits/stdc++.h> #define vi vector<int> #define ve vector #define ll long long #define vf vector<float> #define vll vector<pair<ll,ll>> #define ii pair<int,int> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define fi first #define se second #define INF 1e7 #define unsigned u #define eps 1e-18 #define eps1 1e-25 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL); #define MAX_A 100005 #define V 450 #define re register #define maxi(a,b) ((a) > (b) ? (a) : (b)) ll MOD = 998244353; using namespace std; char grid[1005][1005]; int mov[4][2] = {{0,1},{1,0},{-1,0},{0,-1}}; int main(){ optimise; int r,c; cin >> r >> c; ii start, end; ll dis[r][c]; set<int> wallsc[r], wallsr[c]; for (int i = 0; i < r; ++i) { wallsr[i].insert(-1); wallsr[i].insert(c); } for (int i = 0; i < c; ++i) { wallsc[i].insert(-1); wallsc[i].insert(r); } for (int i = 0; i < r; ++i) { for (int j = 0; j < c; ++j) { cin >> grid[i][j]; dis[i][j] = INF; if(grid[i][j] == 'S'){ start.fi = i,start.se = j; } else if(grid[i][j] == 'C'){ end.fi = i,end.se = j; } else if(grid[i][j] == '#'){ wallsc[i].insert(j); wallsr[j].insert(i); } } } dis[start.fi][start.se] = 0; cout << dis[end.fi][end.se]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...