Submission #154551

# Submission time Handle Problem Language Result Execution time Memory
154551 2019-09-22T16:47:02 Z phillip San (COCI17_san) C++14
48 / 120
141 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];
    }
    v[n-1].push_back(g[n-1]);
    for(int i=n-2;i>=0;i--)
    {
        v[i].push_back(g[i]);
        for(int j=i+1;j<n;j++)
        {
            if(h[j]<h[i])continue;
            for(int l=0;l<v[j].size();l++)v[i].push_back(g[i]+v[j][l]);
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
        {
            if(v[i][j]>=k)ans++;
        }
    }
    cout<<ans;
}

Compilation message

san.cpp: In function 'int main()':
san.cpp:24:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int l=0;l<v[j].size();l++)v[i].push_back(g[i]+v[j][l]);
                         ~^~~~~~~~~~~~
san.cpp:29:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v[i].size();j++)
                     ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4460 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 104 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 141 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 97 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -