제출 #573727

#제출 시각아이디문제언어결과실행 시간메모리
573727moday_morningA Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" #include "grader.cpp" using namespace std; map <int, int> mp; int all(int k, int p) { int sum = 0; for (int i = 0; i < k; i++) { if (mp.find(i + 1 + p) == mp.end()) { mp[i + 1 + p] = skim(i + 1 + p); sum += mp[i + 1 + p]; } } } void solve(int N, int K, long long A, int S) { int l = 0, r = N - K - 1, ll = 2 * A / K, rr = (K + 1 + A) / K; while (l <= r) { int mid = (l + r) / 2, lll = all(1, mid), rrr = all(1, K - 1 + mid); if (ll < lll) { r = mid; } else if (rr < rrr) { l = mid; } else { if (A * 2 > all(K, mid)) { r = mid - 1; } else if (A > all(K, mid)) { l = mid + 1; } else { vector <int> st; for (int i = 0; i < K; i++) { int pos = mid + i + 1; st.push_back(pos); } answer(st); return; } } } l = K; r = N - 1; while (l <= r) { int mid = (l + r) / 2; if (A * 2 > (all(K - 1, 0) + all(mid, 1))) { r = mid - 1; } else if (A < (all(K - 1, 0) + all(mid, 1))) { l = mid - 1; } else { vector <int> st; for (int i = 0; i < K - 1; i++) { int pos = i + 1; st.push_back(pos); } st.push_back(mid + 1); answer(st); return; } } impossible(); }

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'int all(int, int)':
books.cpp:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
/usr/bin/ld: /tmp/ccNqHehY.o: in function `safely_read_int()':
grader.cpp:(.text+0x0): multiple definition of `safely_read_int()'; /tmp/ccg5DJqV.o:books.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccNqHehY.o: in function `safely_read_ll()':
grader.cpp:(.text+0x50): multiple definition of `safely_read_ll()'; /tmp/ccg5DJqV.o:books.cpp:(.text+0x50): first defined here
/usr/bin/ld: /tmp/ccNqHehY.o: in function `answer(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0xa0): multiple definition of `answer(std::vector<int, std::allocator<int> >)'; /tmp/ccg5DJqV.o:books.cpp:(.text+0xa0): first defined here
/usr/bin/ld: /tmp/ccNqHehY.o: in function `impossible()':
grader.cpp:(.text+0x160): multiple definition of `impossible()'; /tmp/ccg5DJqV.o:books.cpp:(.text+0x160): first defined here
/usr/bin/ld: /tmp/ccNqHehY.o: in function `skim(int)':
grader.cpp:(.text+0x1a0): multiple definition of `skim(int)'; /tmp/ccg5DJqV.o:books.cpp:(.text+0x1a0): first defined here
/usr/bin/ld: /tmp/ccNqHehY.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccg5DJqV.o:books.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status