Submission #154553

# Submission time Handle Problem Language Result Execution time Memory
154553 2019-09-22T16:54:25 Z phillip San (COCI17_san) C++14
48 / 120
162 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[49];
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++)
                     ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 3792 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 132 ms 65536 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 162 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 150 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -