Submission #729123

#TimeUsernameProblemLanguageResultExecution timeMemory
729123Jean7A Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms304 KiB
#include <bits/stdc++.h> #include "books.h" #define mid ((l+r)>>1) using namespace std ; const int N = 1e5+5 ; int a[N] ; void solve(int n, int k, long long A, int s) { int sum = 0 ; vector <int> v ; for ( int i = 1 ; i <= k ; i++ ) { a[i] = skim(i) ; sum += a[i] ; v.push_back(i) ; } if ( sum > 2*A ) { impossible () ; } int id = k-1 , xx = n+1 ; while ( sum < A && id >= 0 ) { int l = id+1 , r = xx ; while ( r - l > 1 ) { if ( !a[mid] ) { a[mid] = skim(mid) ; } if ( sum + a[mid] - a[id] < 2*A ) { l = mid ; } else { r = mid ; } } sum -= v[id] ; v[id] = l ; xx = l ; sum += v[id] ; id-- ; if ( sum >= A ) { break ; } } if ( sum < A ) { impossible () ; } answer(v) ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...