제출 #944047

#제출 시각아이디문제언어결과실행 시간메모리
944047thelegendary08A Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
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) { vector<long long int>v(N); for(int i = 1;i<=N;i++){ v[i-1] = skim(i); } ll sum = 0; for(int i = 0;i<K;i++){ sum += v[i]; } if(sum >= A && sum <= 2*A){ vector<int> ret; for(int i = 1;i<=K;i++){ ret.push_back(i); } answer(ret); } if(sum > 2*A)impossible(); int crit = -1; for(int i = 1;i<N - K + 1; i++){ sum -= v[i-1]; sum += v[i+K-1]; if(sum >= A && sum <= 2*A){ vector<int>ret; for(int j = i;j<i+K;j++)ret.push_back(j + 1); answer(ret); } if(sum >2*A){ crit = i; break; } } if(crit == -1)impossible(); else{ long long int s = 0; for(int i = crit - 1;i<crit+K;i++){ s += v[i]; } for(int i = crit-1;i<crit+K;i++){ if(s - v[i] <= 2*A && s-v[i] >= A){ vector<int>ret; for(int j = crit - 1;j<crit+K;j++){ if(j != i){ ret.push_back(j+1); } } answer(ret); } } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:21:5: error: 'll' was not declared in this scope
   21 |     ll sum = 0;
      |     ^~
books.cpp:23:9: error: 'sum' was not declared in this scope
   23 |         sum += v[i];
      |         ^~~
books.cpp:25:8: error: 'sum' was not declared in this scope
   25 |     if(sum >= A && sum <= 2*A){
      |        ^~~
books.cpp:32:8: error: 'sum' was not declared in this scope
   32 |     if(sum > 2*A)impossible();
      |        ^~~
books.cpp:35:9: error: 'sum' was not declared in this scope
   35 |         sum -= v[i-1];
      |         ^~~