제출 #723316

#제출 시각아이디문제언어결과실행 시간메모리
723316MardukA Difficult(y) Choice (BOI21_books)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void solve(int N, int K, long long A, int S){ vector<int> sol; int lo = 0, hi = N+1; while(hi-lo>1){ int mid = (lo+hi)/2; if(skim(mid) >= A) hi = mid; else lo = mid; } int x = hi; int vx = skim(x); long long ans = 0; vector<int> f,l; f.clear(); l.clear(); for(int i = 1;i<K;i++){ long long q = skim(i); ans+=q; f.push_back(q); q = skim(x-i); l.push_back(q); } if(ans+vx >= A && ans+vx <= 2*A){ for(int i = 1;i<K;i++) sol.push_back(i); sol.push_back(x); answer(sol); return; } if(K>=x) impossible(); f.push_back(skim(K)); ans+=f[K-1]; if(ans >= A && ans <= 2*A){ for(int i = 1;i<=K;i++) sol.push_back(i); answer(sol); return; } for(int i = 0;i<K;i++){ if(f[i] == l[i]) impossible(); ans-=f[i]; ans+=l[i]; if(ans >= A && ans <= 2*A){ for(int j = 1+i+1;j<=K;j++) sol.push_back(j); for(int j = x-1;j>=x-1-i;j--) sol.push_back(j); answer(sol); return; } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:11:12: error: 'skim' was not declared in this scope
   11 |         if(skim(mid) >= A) hi = mid;
      |            ^~~~
books.cpp:16:14: error: 'skim' was not declared in this scope
   16 |     int vx = skim(x);
      |              ^~~~
books.cpp:33:9: error: 'answer' was not declared in this scope
   33 |         answer(sol); return;
      |         ^~~~~~
books.cpp:36:14: error: 'impossible' was not declared in this scope
   36 |     if(K>=x) impossible();
      |              ^~~~~~~~~~
books.cpp:43:9: error: 'answer' was not declared in this scope
   43 |         answer(sol); return;
      |         ^~~~~~
books.cpp:47:26: error: 'impossible' was not declared in this scope
   47 |         if(f[i] == l[i]) impossible();
      |                          ^~~~~~~~~~
books.cpp:53:13: error: 'answer' was not declared in this scope
   53 |             answer(sol); return;
      |             ^~~~~~
books.cpp:56:5: error: 'impossible' was not declared in this scope
   56 |     impossible();
      |     ^~~~~~~~~~