# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1230309 | amaw | Trol (COCI19_trol) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#include <iostream>
#include <algorithm>
using namespace std;
unsigned long long memo[4'294'967'295];
unsigned long long jumlah(unsigned long long n) {
if (n < 10) return n;
unsigned long long temp = n % 10 + jumlah(n / 10);
memo[n] = temp;
if (temp < 10) return temp;
else {
if (memo[temp] != -1) return memo[temp];
else return temp % 10 + jumlah(temp / 10);
}
}
int main() {
int q;
cin >> q;
unsigned long long R[q]; unsigned long long L[q];
for (int i = 0; i < q; i++) {
cin >> R[i] >> L[i];
}
fill(memo, memo + 4'294'967'296, -1);
unsigned long long hasil[q] = {0};
for (int i = 0; i < q; i++) {
unsigned long long min = R[i]; unsigned long long maks = L[i];
for (unsigned long long j = min; j <= maks; j++) {
hasil[i] += jumlah(j);
}
}
for (int i = 0; i < q; i++) {
cout << hasil[i] << endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
In file included from /usr/include/c++/11/bits/char_traits.h:39, from /usr/include/c++/11/ios:40, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from trol.cpp:1: In function 'constexpr typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long unsigned int*; _Tp = int]', inlined from 'constexpr void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long unsigned int*; _Tp = int]' at /usr/include/c++/11/bits/stl_algobase.h:969:21, inlined from 'constexpr void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long unsigned int*; _Tp = int]' at /usr/include/c++/11/bits/stl_algobase.h:999:20, inlined from 'int main()' at trol.cpp:27:9: /usr/include/c++/11/bits/stl_algobase.h:924:18: warning: 'void* __builtin_memset(void*, int, long unsigned int)' writing 34359738368 bytes into a region of size 34359738360 overflows the destination [-Wstringop-overflow=] 924 | *__first = __tmp; | ~~~~~~~~~^~~~~~~ trol.cpp: In function 'int main()': trol.cpp:5:20: note: destination object 'memo' of size 34359738360 5 | unsigned long long memo[4'294'967'295]; | ^~~~ In file included from /usr/include/c++/11/bits/char_traits.h:39, from /usr/include/c++/11/ios:40, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from trol.cpp:1: In function 'constexpr typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long unsigned int*; _Tp = int]', inlined from 'constexpr void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long unsigned int*; _Tp = int]' at /usr/include/c++/11/bits/stl_algobase.h:969:21, inlined from 'constexpr void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long unsigned int*; _Tp = int]' at /usr/include/c++/11/bits/stl_algobase.h:999:20, inlined from 'int main()' at trol.cpp:27:9: /usr/include/c++/11/bits/stl_algobase.h:924:18: warning: 'void* __builtin_memset(void*, int, long unsigned int)' writing 34359738368 bytes into a region of size 34359738360 overflows the destination [-Wstringop-overflow=] 924 | *__first = __tmp; | ~~~~~~~~~^~~~~~~ trol.cpp: In function 'int main()': trol.cpp:5:20: note: destination object 'memo' of size 34359738360 5 | unsigned long long memo[4'294'967'295]; | ^~~~ /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()': (.text._ZNSt8ios_base4InitC2Ev+0x1c): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0x67): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0x87): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0xa7): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cin_sync' defined in .bss._ZN14__gnu_internal12buf_cin_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o) (.text._ZNSt8ios_base4InitC2Ev+0xe2): additional relocation overflows omitted from the output (.text._ZNSt8ios_base4InitC2Ev+0x1c6): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x260): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x2e2): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x353): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x541): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x5e5): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x670): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax (.text._ZNSt8ios_base4InitC2Ev+0x6e9): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax /usr/bin/ld: final link failed collect2: error: ld returned 1 exit status