# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
473194 | 2021-09-15T10:02:31 Z | MamdouhN | San (COCI17_san) | C++17 | 1000 ms | 204 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" int n,k; int towers[100],gold[100]; int solve(int idx,int sum) { //cout<<idx<<" "<<sum<<endl; if(idx==n)return 0; sum+=gold[idx]; int ret = 0; if(sum>=k)ret = 1; for(int i=idx+1;i<n;i++) { if(towers[i]>=towers[idx])ret+=solve(i,sum); } return ret; } main() { cin>>n>>k; for(int i=0;i<n;i++)cin>>towers[i]>>gold[i]; int ans = 0; for(int i=0;i<n;i++)ans+=solve(i,0); cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1075 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1062 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |