제출 #366403

#제출 시각아이디문제언어결과실행 시간메모리
366403VEGAnnPatkice (COCI20_patkice)C++14
0 / 50
1086 ms364 KiB
#include <bits/stdc++.h> using namespace std; const int N = 110; const int oo = 2e9; int n, m, ans = oo, sx, sy; string pat = "ENSW"; char s[N][N], let = 'a'; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _LOCAL freopen("in.txt","r",stdin); #endif // _LOCAL cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { cin >> s[i][j]; if (s[i][j] == 'o'){ sx = i; sy = j; } } for (int it = 0; it < 4; it++){ int cx = sx, cy = sy, len = 1; if (it == 0) cy++; else if (it == 1) cx--; else if (it == 2) cx++; else cy--; while (1){ if (s[cx][cy] == '.') break; if (s[cx][cy] == 'x') { if (len < ans){ ans = len; let = pat[it]; } break; } len++; if (s[cx][cy] == '^') cx--; else if (s[cx][cy] == 'v') cx++; else if (s[cx][cy] == '>') cy++; else cy--; } } if (ans == oo) cout << ":("; else cout << ":)\n" << let; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...