Submission #154551

#TimeUsernameProblemLanguageResultExecution timeMemory
154551phillipSan (COCI17_san)C++14
48 / 120
141 ms65540 KiB
#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 (stderr)

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 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...