제출 #667392

#제출 시각아이디문제언어결과실행 시간메모리
667392someoneA Difficult(y) Choice (BOI21_books)C++14
컴파일 에러
0 ms0 KiB
//#include "books.h" #include <bits/stdc++.h> #define ll long long using namespace std; const int MAXN = 2e5 + 42; int nb = 0, book[MAXN]; int skim(int i) { nb++; cout << i << ' ' << book[i] << '\n'; return book[i]; } void answer(vector<int> v) { cout << "answer :"; for(int i : v) cout << ' ' << i; } void impossible() { cout << "impossible"; } ll val[MAXN]; ll get(int i) { if(val[i] == 0) val[i] = skim(i); return val[i]; } void solve(int N, int K, ll A, int S) { for(int i = 1; i <= N; i++) get(i); vector<int> ans; ll sum = 0; for(int i = 1; i <= K; i++) sum += val[i]; int last = K; for(int i = K; i <= N; i++) { last = i; if(i == N || sum + val[i+1] - val[K] > 2*A) i = N+1; } for(int i = K; i > 0; i--) { if(sum + val[last + i - K] - val[i] <= 2*A) { sum += val[last + i - K] - val[i]; ans.push_back(last + i - K); } if(sum >= A) { for(int j = 1; j < i; j++) ans.push_back(j); answer(ans); return; } } impossible(); } signed main() { int N, K, A, S; cin >> N >> K >> A >> S; for(int i = 1; i <= N; i++) cin >> book[i]; solve(N, K, A, S); }

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

/usr/bin/ld: /tmp/cc1wqsBf.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/cczOLlwg.o:books.cpp:(.text+0xa0): first defined here
/usr/bin/ld: /tmp/cc1wqsBf.o: in function `impossible()':
grader.cpp:(.text+0x160): multiple definition of `impossible()'; /tmp/cczOLlwg.o:books.cpp:(.text+0x150): first defined here
/usr/bin/ld: /tmp/cc1wqsBf.o: in function `skim(int)':
grader.cpp:(.text+0x1a0): multiple definition of `skim(int)'; /tmp/cczOLlwg.o:books.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cc1wqsBf.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cczOLlwg.o:books.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status