제출 #1009183

#제출 시각아이디문제언어결과실행 시간메모리
1009183alexddA Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; map<int,int> mp; int query(int x) { if(mp[x]==0) mp[x] = skim(x); return mp[x]; } pair<long long,long long> aproximativ(int st, int K) { int dr = st+K-1; long long x = query(st); long long y = query(dr); pair<long long,long long> aux = {x+y,x+y}; for(int i=2;i<K;i++) { aux.first += x+i-1; aux.second += y-i+1; } return aux; } long long exact(int st, int K) { int dr = st+K-1; long long sum=0; for(int i=st;i<=dr;i++) sum += query(i); return sum; } void solve(int N, int K, long long A, int S) { int st=1,dr=n-k+1,ans=-1; while(st<=dr) { int mij=(st+dr)/2; if(exact(mij,K)>=a) { if(exact(mij,K)<=2*a) { vector<int> sol; for(int i=mij;i<mij+K;i++) sol.push_back(i); answer(sol); return; } dr = mij-1; } else st = mij+1; } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:36:17: error: 'n' was not declared in this scope
   36 |     int st=1,dr=n-k+1,ans=-1;
      |                 ^
books.cpp:36:19: error: 'k' was not declared in this scope
   36 |     int st=1,dr=n-k+1,ans=-1;
      |                   ^
books.cpp:40:26: error: 'a' was not declared in this scope
   40 |         if(exact(mij,K)>=a)
      |                          ^