fork(1) download
  1. CodeChef submission 12131424 (C++14) plaintext list. Status: AC, problem MCO16303, contest MCO16TS. By zscoder (zscoder), 2016-11-22 12:57:37.
  2. #include <bits/stdc++.h>
  3. #include <ext/pb_ds/assoc_container.hpp>
  4. #include <ext/pb_ds/tree_policy.hpp>
  5.  
  6. using namespace std;
  7. using namespace __gnu_pbds;
  8.  
  9. #define fi first
  10. #define se second
  11. #define mp make_pair
  12. #define pb push_back
  13. #define fbo find_by_order
  14. #define ook order_of_key
  15.  
  16. typedef long long ll;
  17. typedef pair<ll,ll> ii;
  18. typedef vector<int> vi;
  19. typedef long double ld;
  20. typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
  21. typedef set<int>::iterator sit;
  22. typedef map<int,int>::iterator mit;
  23. typedef vector<int>::iterator vit;
  24.  
  25. const int MOD = 1e9 + 7;
  26. int dp[501][200001];
  27. int a[501];
  28.  
  29. int main()
  30. {
  31. ios_base::sync_with_stdio(0); cin.tie(0);
  32. int n; cin >> n;
  33. int sum = 0;
  34. for(int i = 1; i <= n; i++)
  35. {
  36. cin >> a[i];
  37. sum += a[i];
  38. }
  39. dp[0][sum] = 1;
  40. for(int i = 1; i <= n; i++)
  41. {
  42. for(int j = 0; j <= 2*sum; j++)
  43. {
  44. dp[i][j] = 0;
  45. if(j+a[i]<=2*sum) dp[i][j] += dp[i-1][j+a[i]];
  46. if(j-a[i]>=0) dp[i][j] += dp[i-1][j-a[i]];
  47. dp[i][j]%=MOD;
  48. }
  49. }
  50. int l, r;
  51. cin>>l>>r;
  52. l += sum; r += sum;
  53. ll ans = 0;
  54. for(int i = l; i <= r; i++)
  55. {
  56. ans = (ans + dp[n][i])%MOD;
  57. }
  58. cout<<ans;
  59. }
  60.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: 'CodeChef' does not name a type
 CodeChef submission 12131424 (C++14) plaintext list. Status: AC, problem MCO16303, contest MCO16TS. By zscoder (zscoder), 2016-11-22 12:57:37.
 ^
stdout
Standard output is empty