제출 #581146

#제출 시각아이디문제언어결과실행 시간메모리
581146l_rehoA Difficult(y) Choice (BOI21_books)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; // // --- Sample implementation for the task books --- // // To compile this program with the sample grader, place: // books.h books_sample.cpp sample_grader.cpp // in a single folder and run: // g++ books_sample.cpp sample_grader.cpp // in this folder. // void solve(int N, int K, long long A, int S) { // TODO implement this function vector<long long> vals; for(int i = 1; i <= N; i++){ long long curr_diff = skim(i); vals.push_back(curr_diff); } ll sum = 0; deque<int> ans; vector<int> res; for(int i = 0; i < K; i++){ ans.push_back(i+1); sum += vals[i]; } if(sum >= A && sum <= 2*A){ for(int i = 0; i < K; i++) res.push_back(ans[i]); answer(res); } ans.pop_back(); sum -= vals[K-1]; for(int j = 0; j <= N-K; j++){ for(int i = j+K-1; i < N; i++){ sum += vals[i]; ans.push_back(i+1); // test if(sum >= A && sum <= 2*A){ for(int k = 0; k < K; k++) res.push_back(ans[k]); answer(res); } if(sum > 2*A) break; sum -= vals[i]; ans.pop_back(); } sum -= vals[j]; ans.pop_front(); sum += vals[j+K-1]; ans.push_back(j+K); } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:27:2: error: 'll' was not declared in this scope
   27 |  ll sum = 0;
      |  ^~
books.cpp:34:3: error: 'sum' was not declared in this scope
   34 |   sum += vals[i];
      |   ^~~
books.cpp:37:5: error: 'sum' was not declared in this scope
   37 |  if(sum >= A && sum <= 2*A){
      |     ^~~
books.cpp:44:2: error: 'sum' was not declared in this scope
   44 |  sum -= vals[K-1];
      |  ^~~