Submission #822758

#TimeUsernameProblemLanguageResultExecution timeMemory
822758Minindu206Memory (IOI10_memory)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void init() { #ifndef ONLINE_JUDGE freopen("input.in", "r", stdin); freopen("output.txt", "w", stdout); #endif } int n, m, k; void bfs(vector<string> &arr) { queue<pair<int, int>> q; q.push({0, 0}); vector<pair<int, int>> dir{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; while (!q.empty()) { int x = q.front().first; int y = q.front().second; q.pop(); arr[x][y] = 'O'; for (pair<int, int> p : dir) { int cx = x + p.first; int cy = y + p.second; if (cx < 0 || cy < 0 || cx >= n || cy >= m) continue; if(arr[cx][cy] != '.') continue; q.push({cx, cy}); } } } int main() { init(); cin >> n >> m >> k; string a(m, '.'); string b(m, 'X'); vector<string> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } bfs(arr); for (int i = 0; i < n; i++) cout << arr[i] << "\n"; }

Compilation message (stderr)

memory.cpp: In function 'void init()':
memory.cpp:6:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     freopen("input.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
memory.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccTjMDES.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9fODeW.o:memory.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccTjMDES.o: in function `main':
grader.cpp:(.text.startup+0x2f): undefined reference to `play()'
collect2: error: ld returned 1 exit status