Submission #693358

# Submission time Handle Problem Language Result Execution time Memory
693358 2023-02-02T23:30:02 Z BobCompetitiveProgramming A Difficult(y) Choice (BOI21_books) C++17
0 / 100
0 ms 280 KB
#include <books.h>

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <cstring>
#include <queue>
#include <array>
using namespace std; using ll=int64_t;
#define rep(i,n) for(ll i=0; i<ll(n); ++i)
#define vi vector<ll>
#define all(x) begin(x), end(x)
#define pi pair<ll, ll>


// N books, buy K books, difficulty between A and 2A, skims allowed.
void solve(int N, int K, long long A, int S){ 
    vector<int> buys;

    long long left=1, right=N;
    while(right-left+1 >= K && S >= 2){
        long long mid = left + (right-left)/2; 
        if(mid + K > N){
            if(left) --left;
            else break;
            continue;
        }
        cout << mid << endl;
        double avg_diff = ((double(skim(mid)) + double(skim(mid+K)))/2.0)*K;
        S-=2;
        if(A <= avg_diff && avg_diff <= 2*A){
            for(ll i=mid; mid<=mid+K; ++i) buys.push_back(i);
            answer(buys);
        }

        if(avg_diff < A) left=mid;
        else right=mid; 
    }
    impossible();
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 280 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 280 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 280 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 280 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 280 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -