| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1191635 | SmuggingSpun | Patkice (COCI20_patkice) | C++20 | 0 ms | 328 KiB |
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
const int lim = 105;
char a[lim][lim];
int n, m;
bitset<lim>vis[lim];
void move(int i, int j, const char ans){
if(a[i][j] == 'x'){
cout << ":)\n" << ans;
exit(0);
}
if(vis[i].test(j) || a[i][j] == '.'){
return;
}
vis[i].set(j);
if(a[i][j] == '^'){
move(i - 1, j, ans);
}
else if(a[i][j] == 'v'){
move(i + 1, j, ans);
}
else if(a[i][j] == '<'){
move(i, j - 1, ans);
}
else{
move(i, j + 1, ans);
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
cin >> n >> m;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cin >> a[i][j];
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if(a[i][j] == 'o'){
for(int k = 1; k <= n; k++){
vis[k].reset();
}
if(j < m){
move(i, j + 1, 'E');
}
if(i > 0){
move(i - 1, j, 'N');
}
if(i < n){
move(i + 1, j, 'S');
}
if(j > 0){
move(i, j - 1, 'W');
}
return cout << ":(", 0;
}
}
}
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
