답안 #199918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199918 2020-02-04T01:36:34 Z mdn2002 San (COCI17_san) C++14
0 / 120
120 ms 65540 KB
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
long long n,k,a[44],b[44],nm;
long long tree[2500006],ans;
vector<pair<int,int> >on,to;
vector<int>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 y,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(y==mx+1)return;
    if(a[x]<=a[y])bt(y,y+1,mx,sum+b[y]);
    bt(x,y+1,mx,sum);
}
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];
    bt(0,0,n,0);
  cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 59 ms 32576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 114 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 119 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 120 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -