Submission #1060410

#TimeUsernameProblemLanguageResultExecution timeMemory
1060410KazooCollecting Mushrooms (NOI18_collectmushrooms)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxR = 5e5+5; int r, c, d, k; string garden[maxR]; bool watered[maxR][maxR]; int main(){ cin >> r >> c >> d >> k; for(int i = 0; i<r; i++){ cin >> garden[i]; } vector<vector<int>> kena; for(int i = 0; i<r; i++){ vector<int> ps; for(int j = 0; j<c; j++){ ps.push_back(0); } kena.push_back(ps); } for(int i = 0; i<r; i++){ for(int j = 0; j<c; j++){ if(garden[i][j]=='S') { // atas kiri [i-d][j-d] // bawah kanan [i+d][j+d] // atas kanan [i-d][j+d] // bawah kiri [i+d][j-d] int atas = max(i-d, 0); int kiri = max(j-d, 0); kena[atas][kiri]++; int kanan = -1, bawah = -1; if(i+d+1<=r-1) bawah = i+d+1; if(j+d+1<=c-1) kanan = j+d+1; if(kanan!=-1) kena[atas][kanan]--; if(bawah!=-1) kena[bawah][kiri]--; if(kanan!=-1 && bawah!=-1) kena[kanan][bawah]++; } } } ll ans = 0; for(int i = 0; i<r; i++){ for(int j = 0; j<c; j++){ if(i!=0) kena[i][j] += kena[i-1][j]; if(j!=0) kena[i][j] += kena[i][j-1]; if(i!=0 && j!=0) kena[i][j] -= kena[i-1][j-1]; if(garden[i][j]=='M' && kena[i][j] >= k) ans++; } // cout << endl; } cout << ans << endl; }

Compilation message (stderr)

/tmp/ccxe7ZNK.o: in function `__tcf_0':
mushrooms.cpp:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `garden[abi:cxx11]' defined in .bss section in /tmp/ccxe7ZNK.o
/tmp/ccxe7ZNK.o: in function `main':
mushrooms.cpp:(.text.startup+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccxe7ZNK.o
mushrooms.cpp:(.text.startup+0x10): 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)
mushrooms.cpp:(.text.startup+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccxe7ZNK.o
mushrooms.cpp:(.text.startup+0x47): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccxe7ZNK.o
mushrooms.cpp:(.text.startup+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccxe7ZNK.o
mushrooms.cpp:(.text.startup+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccxe7ZNK.o
mushrooms.cpp:(.text.startup+0x73): relocation truncated to fit: R_X86_64_PC32 against symbol `garden[abi:cxx11]' defined in .bss section in /tmp/ccxe7ZNK.o
mushrooms.cpp:(.text.startup+0x7c): 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)
mushrooms.cpp:(.text.startup+0x94): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccxe7ZNK.o
mushrooms.cpp:(.text.startup+0xeb): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status