This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include<books.h>
using namespace std;
using ll = long long;
using db = double;
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
#define f first
#define s second
const int MOD = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);
ll nn, kk, aa;
ll arr[100007];
// ll answer(vector<int> x){
//
// cout<<"ok";
// }
//
// ll skim(ll x){
//
// return x+2;
// }
//
// void impossible(){
//
// cout<<"not ok";
// }
vector<pair<ll, ll> > d;
void c(ll siz, ll idx, ll sum){
if(siz==kk){
vector<int> temp;
for(ll i = 0; i < kk; i++){
// cout<<d[i].f<<" ";
sum+=d[i].f;
temp.pb(d[i].s);
}
// cout<<sum<<"\n";
if(sum>=aa and sum<=2*aa)answer(temp);
return;
}
if (idx > nn)return;
d[siz].f = arr[idx];
d[siz].s = idx;
c(siz+1, idx+1, sum);
c(siz, idx+1, sum);
}
void solve(int n, int k, ll a, int s){
for(ll i = 1; i <= n; i++){
arr[i] = skim(i);
}
nn = n, kk = k, aa = a;
d.resize(k+1);
c(0, 1, 0);
impossible();
}
//
// int main(){
//
// solve(5, 3, 10, 0);
// }
//
# | 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... |