Submission #1191634

#TimeUsernameProblemLanguageResultExecution timeMemory
1191634SmuggingSpunPatkice (COCI20_patkice)C++20
0 / 50
0 ms324 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(i > 0){ move(i - 1, j, 'N'); } if(i < n){ move(i + 1, j, 'S'); } if(j > 0){ move(i, j - 1, 'W'); } if(j < m){ move(i, j + 1, 'E'); } return cout << ":(", 0; } } } }

Compilation message (stderr)

patkice.cpp: In function 'int main()':
patkice.cpp:33:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...