제출 #416710

#제출 시각아이디문제언어결과실행 시간메모리
416710jainbot27A Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
// Difficult(y) Choice

#include <bits/stdc++.h>
#include "books.h"
using namespace std;

using ll=long long;

#define FOR(i, a, b) for(int i=a; i<b; i++) 
#define ROF(i, a, b) for(int i=b-1; i>=a; i--)
#define F0R(i, n) FOR(i, 0, n) 
#define R0F(i, n) ROF(i, 0, n) 

#define f first
#define s second
#define pb push_back
#define siz(x) (int)x.size() 

int n, k, a, s;

void solve(int N, int K, ll A, int S){
    n=N, k=K, a=A, s=S; 
    assert(n==s);
    // task is query 40 books and try to see if we can get a set of K books such that A<=\sum<=2A we have K is less than 10 so SMALL 
    // solve subtask by subtask:
    /*
        observation, problem has to require BINARY SEARCH
        subtask 1: we can just like iterte over first 2 books, check which if we have a third one 
        subtask 2: if the last element we take is <=A then if the previous elements are >A, we can find a solution 
    */
    vector<ll> x(n); 
    F0R(i, n){
        x[i]=skim(i+1); 
    }
    {
        ll p=0; 
        F0R(i, k-1) p+=x[i]; 
        FOR(i, k-1, n){
            if(p+x[i]>=A&&2*A<=p+x[i]){
                vector<int> ans; 
                F0R(i, k-1) ans.pb(i+1); 
                ans.pb(i+1); 
                answer(ans); 
            }
        }
    }
    ll sum=0; 
    F0R(i, k-1) sum+=x[i]; 
    FOR(i, k-1, n){
        sum+=x[i]; 
        if(sum>=a&&sum<=2*a){
            vector<int> ans;
            FOR(j, i-k+1, i+1)  ans.pb(j+1); 
            answer(ans); 
        }
        sum-=x[i-k+1];
    }
    impossible();
}

int main(){
    cin.tie(0)->sync_with_stdio(0); 

}

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

/usr/bin/ld: /tmp/ccNQyte4.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc3fSU87.o:books.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status