Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: dddrrrr
Problemset: Path Finding
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-15 10:23:04
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
int n ,k;cin >> n >> k;
vector <vector <char>> vec(n ,vector <char>(n ,'_'));
vector <pair <int ,int>> p(k);
for(int i=0 ;i<k ;i++){
cin >> p[i].first >> p[i].second;
if(p[i].first >= n || p[i].first < 0 || p[i].second >= n || p[i].second < 0){
cout << "Out of range";
return 0;
}
}
char des = 'A';
for(int idx=0 ;idx<k-1 ;idx++){
int aj = p[idx].second ,bj = p[idx+1].second;
int ai = p[idx].first ,bi = p[idx+1].first;
if(aj < bj){
for(int i=aj ;i<bj ;i++){
vec[ai][i] = '>';
}
}
else{
for(int i=bj ;i<aj ;i++){
vec[ai][i] = '<';
}
}
if(ai < bi){
for(int i=ai ;i<=bi ;i++){
vec[i][bj] = 'v';
}
}
else{
for(int i=bi ;i<=ai ;i++){
vec[i][bj] = '^';
}
}
vec[ai][aj] = des;
des++;
}
vec[p[k-1].first][p[k-1].second] = des;
for(auto row : vec){
for(auto col : row){
cout << col ;
}
cout << "\n";
}
return 0;
}