답안 #154552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154552 2019-09-22T16:53:33 Z phillip San (COCI17_san) C++14
48 / 120
164 ms 65540 KB
#include <bits/stdc++.h>
#define ll long long
#define lp (pos+pos+1)
#define rp (2*pos+2)
#define m (l+r)/2
using namespace std;
vector<ll>v[40];
ll h[49],g[49],k,ans;
int n;
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>h[i]>>g[i];
    }
    for(int i=n-1;i>=0;i--)
    {
        v[i].push_back(g[i]);
        for(int j=0;j<i;j++)
        {
            if(h[j]>h[i])continue;
            for(int l=0;l<v[i].size();l++)v[j].push_back(g[j]+v[i][l]);
        }
        for(int j=0;j<v[i].size();j++)
        {
            if(v[i][j]>=k)ans++;
        }
        //cout<<ans<<"\n";
        v[i].clear();
    }
    cout<<ans;
}

Compilation message

san.cpp: In function 'int main()':
san.cpp:23:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int l=0;l<v[i].size();l++)v[j].push_back(g[j]+v[i][l]);
                         ~^~~~~~~~~~~~
san.cpp:25:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v[i].size();j++)
                     ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3792 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 135 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 164 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 151 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -