Submission #166658

#TimeUsernameProblemLanguageResultExecution timeMemory
166658ArKCaSan (COCI17_san)C++17
0 / 120
485 ms380 KiB
#include<bits/stdc++.h> #define ll long long #define mod 1000000007 #define pb push_back #define pob pop_back #define N 45 using namespace std; int g[N],h[N],n,k; vector<int>v[N]; int solve(int x,int mani){ // printf("%d %d\n",x,mani); ll ans=0; if(mani+g[x]>=k){ return 1; } for(int i=0;i<v[x].size();i++){ ans+=solve(v[x][i],mani+g[x]); } return ans; } int main(){ // freopen("a.gir","r",stdin); // freopen("a.cik","w",stdout); scanf("%d %d",&n,&k); for(int i=0;i<n;i++){ scanf("%d %d",&h[i],&g[i]); } for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ if(h[j]>=h[i]){ v[i].pb(j); } } } ll ans=0; for(int i=0;i<n;i++){ ans+=solve(i,0); } printf("%lld\n",ans ); }

Compilation message (stderr)

san.cpp: In function 'int solve(int, int)':
san.cpp:18:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<v[x].size();i++){
              ~^~~~~~~~~~~~
san.cpp: In function 'int main()':
san.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&k);
     ~~~~~^~~~~~~~~~~~~~~
san.cpp:29:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d %d",&h[i],&g[i]);
      ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...