Submission #166659

#TimeUsernameProblemLanguageResultExecution timeMemory
166659ArKCaSan (COCI17_san)C++17
48 / 120
1066 ms376 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; ll g[N],h[N],n,k; vector<ll>v[N]; ll solve(ll x,ll mani){ // printf("%d %d\n",x,mani); ll ans=0; if(mani+g[x]>=k){ ans=1; } for(ll 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("%lld %lld",&n,&k); for(ll i=0;i<n;i++){ scanf("%lld %lld",&h[i],&g[i]); } for(ll i=0;i<n;i++){ for(ll j=i+1;j<n;j++){ if(h[j]>=h[i]){ v[i].pb(j); } } } ll ans=0; for(ll i=0;i<n;i++){ ans+=solve(i,0); } printf("%lld\n",ans ); }

Compilation message (stderr)

san.cpp: In function 'long long int solve(long long int, long long int)':
san.cpp:18:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ll 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("%lld %lld",&n,&k);
     ~~~~~^~~~~~~~~~~~~~~~~~~
san.cpp:29:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%lld %lld",&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...