Submission #199964

#TimeUsernameProblemLanguageResultExecution timeMemory
199964mdn2002San (COCI17_san)C++14
48 / 120
91 ms65540 KiB
#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; long long n,k,a[44],b[44],nm,tree[2500006],ans; vector<pair<int,long long> >on,to; vector<long long>vt,tk; map<long long,int>mp; void up(int nod,int l,int r,int x) { if(x<l||r<x)return; if(l==r) { tree[nod]++; return; } int mid=(l+r)/2; up(nod*2,l,mid,x); up(nod*2+1,mid+1,r,x); tree[nod]=tree[nod*2]+tree[nod*2+1]; } int qr(int nod,int l,int r,int x,int y) { if(x<=l&&r<=y)return tree[nod]; if(y<l||r<x)return 0; int mid=(l+r)/2; return qr(nod*2,l,mid,x,y)+qr(nod*2+1,mid+1,r,x,y); } void bt(int x,int mx,long long sum) { if(sum>=k)ans++; if(sum>0) { if(mx==n/2)on.push_back({a[x],sum}); else { to.push_back({a[x],sum}); tk.push_back(sum); } vt.push_back(sum); } if(x==mx+1)return; for(int i=x+1;i<=mx;i++) { if(a[x]<=a[i])bt(i,mx,sum+b[i]); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("gpsduel.in","r",stdin); //freopen("gpsduel.out","w",stdout); cin>>n>>k; for(int i=1;i<=n;i++)cin>>a[i]>>b[i]; for(int i=1;i<=n;i++)bt(i,n,b[i]); cout<<ans; }
#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...