Submission
Status:
[PP-SSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: detectives_conan
Problemset: Path Finding
Language: cpp
Time: 0.003 second
Submitted On: 2026-07-04 11:14:23
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n; cin >> n;
bool ck = false;
vector<vector<char>> res(n, vector<char>(n, '_'));
int q; cin >> q;
q--;
int px, py; cin >> px >> py;
char a = 'A';
res[px][py] = a;
a++;
while(q--){
int x, y; cin >> x >> y;
if(x >= n || y >= n || x < 0 || y < 0 || ck){
ck = true;
continue;
}
res[x][y] = a;
a++;
if(y > py){
for(int i = py + 1; i < y; ++i) res[px][i] = '>';
}
else if(y < py){
for(int i = y + 1; i < py; ++i) res[px][i] = '<';
}
if(x > px){
for(int i = px; i < x; ++i) res[i][y] = 'v';
}
else if(x < px){
for(int i = x + 1; i <= px; ++i) res[i][y] = '^';
}
px = x, py = y;
}
if(ck){
cout << "Out of range\n";
return 0;
}
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j) cout << res[i][j];
cout << '\n';
}
}