# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166657 | 2019-12-03T11:59:15 Z | ArKCa | San (COCI17_san) | C++17 | 1000 ms | 376 KB |
#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){ ans=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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1039 ms | 376 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1037 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1072 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |