# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
550050 | ToroTN | A Difficult(y) Choice (BOI21_books) | C++14 | 1 ms | 220 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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.
//
int n,m,s;
vector<pair<long long,int> > v;
long long a,num,qs[100005];
long long query(int l,int r)
{
if(l==0)return qs[r];
return qs[r]-qs[l-1];
}
void solve(int N, int K, long long A, int S) {
// TODO implement this function
n=N;
m=K;
a=A;
s=S;
num=a/m;
int st=1,ed=n,md;
while(ed>=st)
{
md=(st+ed)/2;
long long val=skim(md);
if(val>num)
{
ed=md-1;
}else
{
st=md+1;
}
}
//printf("%d %d %d\n",st,md,ed);
for(int i=st-m-1;i<=st-1;i++)
{
if(i>=1&&i<=n)
{
v.push_back({skim(i),i});
}
}
if(st>=1&&st<=n)
{
v.push_back({skim(st),st});
}
for(int i=st+1;i<=st+m+1;i++)
{
if(i>=1&&i<=n)
{
v.push_back({skim(i),i});
}
}
qs[0]=v[0].first;
for(int i=1;i<v.size();i++)
{
qs[i]=qs[i-1]+v[i].first;
}
for(int i=0;i<=v.size()-m;i++)
{
if(query(i,i+m-1)>=a&&query(i,i+m-1)<=2*a)
{
vector<int> ans;
for(int j=i;j<=i+m-1;j++)
{
ans.push_back(v[j].second);
}
answer(ans);
}
}
impossible();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |