Submission #642560

#TimeUsernameProblemLanguageResultExecution timeMemory
642560moday_morningT-Covering (eJOI19_covering)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int ar[1000006][1000006]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> ar[i][j]; } } int q; cin >> q; while (q--) { int i, j; cin >> i >> j; vector <int> a; a.push_back(ar[i+1][j]); a.push_back(ar[i-1][j]); a.push_back(ar[i][j+1]); a.push_back(ar[i][j-1]); int sum = 0, mn = INT_MAX, ind; for (int i = 0; i < 4; i++) { mn = min(mn, a[i]); if (a[i] == mn) { ind = i; } } for (int i = 0; i < 4; i++) { if (ind != i) { sum += a[i]; } } cout << sum << "\n"; } }

Compilation message (stderr)

covering.cpp: In function 'int main()':
covering.cpp:34:4: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |    if (ind != i) {
      |    ^~
/tmp/ccgLjiaF.o: in function `main':
covering.cpp:(.text.startup+0x17): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
covering.cpp:(.text.startup+0x3e): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
covering.cpp:(.text.startup+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
covering.cpp:(.text.startup+0xbc): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
covering.cpp:(.text.startup+0xfe): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
covering.cpp:(.text.startup+0x231): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/ccgLjiaF.o: in function `_GLOBAL__sub_I_ar':
covering.cpp:(.text.startup+0x32b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
covering.cpp:(.text.startup+0x349): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status