Submission #465627

#TimeUsernameProblemLanguageResultExecution timeMemory
465627myvaluskaPatkice (COCI20_patkice)C++14
30 / 50
1 ms204 KiB
// palindromefree.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; //long long int cifra[20]; vector<vector<char>>v; bool dasa(pair<int,int>zac) { int i = 0; for (;;i++) { if (v[zac.first][zac.second] == '.') { return false; } if (v[zac.first][zac.second] == 'o') { return false; } if (v[zac.first][zac.second] == 'x') { return true; } if (v[zac.first][zac.second] == '<') { zac.second -= 1; continue; } if (v[zac.first][zac.second] == '>') { zac.second += 1; continue; } if (v[zac.first][zac.second] == 'v') { zac.first += 1; continue; } if (v[zac.first][zac.second] == '^') { zac.first -= 1; continue; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; v.resize(n, vector<char>(m,'.')); pair<int, int>o; pair<int, int>x; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> v[i][j]; if (v[i][j] == 'o') { o = { i,j }; } else if (v[i][j] == 'x') { x = { i,j }; } } } /*for (int i = 0; i < n + 2; i++) { for (int j = 0; j < m + 2; j++) { cout << v[i][j]; if (j == m+1) { cout << endl; } else { //cout << " "; } } }*/ /*pair<int, int>zac = {o.first - 1,o.second}; cout << zac.first << ' '; cout << zac.second << endl; int i = 0; for (;; i++) { cout << zac.first << ' '; cout << zac.second << endl; if (v[zac.first][zac.second] == '.') { break; } if (v[zac.first][zac.second] == 'x') { cout << "YES" << endl; break; } if (v[zac.first][zac.second] == '<') { zac.second -= 1; continue; } if (v[zac.first][zac.second] == '>') { zac.second += 1; continue; } if (v[zac.first][zac.second] == 'v') { zac.first += 1; continue; } if (v[zac.first][zac.second] == '^') { zac.first -= 1; continue; } }*/ if (dasa({o.first-1,o.second}) == true) { cout << ":)" << endl; cout << "N" << endl; return 0; } if (dasa({o.first+1,o.second}) == true) { cout << ":)" << endl; cout << "S" << endl; return 0; } if (dasa({o.first,o.second+1}) == true) { cout << ":)" << endl; cout << "E" << endl; return 0; } if (dasa({o.first,o.second-1}) == true) { cout << ":)" << endl; cout << "W" << endl; return 0; } cout << ":(" << endl; return 0; //std::cout << "Hello World!\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...