fork download
  1. #pragma GCC optimize("Ofast")
  2. #pragma GCC optimize("unroll-loops")
  3. #pragma GCC optimize("inline")
  4. #include<bits/stdc++.h>
  5. using namespace std;
  6. template<class T> struct cLtraits_identity{
  7. using type = T;
  8. }
  9. ;
  10. template<class T> using cLtraits_try_make_signed =
  11. typename conditional<
  12. is_integral<T>::value,
  13. make_signed<T>,
  14. cLtraits_identity<T>
  15. >::type;
  16. template <class S, class T> struct cLtraits_common_type{
  17. using tS = typename cLtraits_try_make_signed<S>::type;
  18. using tT = typename cLtraits_try_make_signed<T>::type;
  19. using type = typename common_type<tS,tT>::type;
  20. }
  21. ;
  22. template<class S, class T> inline auto min_L(S a, T b)
  23. -> typename cLtraits_common_type<S,T>::type{
  24. return (typename cLtraits_common_type<S,T>::type) a <= (typename cLtraits_common_type<S,T>::type) b ? a : b;
  25. }
  26. template<class S, class T> inline S chmax(S &a, T b){
  27. if(a<b){
  28. a=b;
  29. }
  30. return a;
  31. }
  32. #define main dummy_main
  33. int main(){
  34. return 0;
  35. }
  36. #undef main
  37. class Solution{
  38. public:
  39. long long mostPoints(vector<vector<int>>& A){
  40. int i;
  41. int N = A.size();
  42. static long long dp[100000+2];
  43. for(i=(0);i<(N+1);i++){
  44. dp[i] = 0;
  45. }
  46. for(i=(0);i<(N);i++){
  47. chmax(dp[i+1], dp[i]);
  48. chmax(dp[min_L(N, i+A[i][1]+1)], dp[i] + A[i][0]);
  49. }
  50. return dp[N];
  51. }
  52. }
  53. ;
  54. // cLay version 20220116-1
  55.  
  56. // --- original code ---
  57. // #define main dummy_main
  58. // {}
  59. // #undef main
  60. //
  61. // class Solution {
  62. // public:
  63. // ll mostPoints(VVI& A){
  64. // int N = A.size();
  65. // static ll dp[1d5+2];
  66. // rep(i,N+1) dp[i] = 0;
  67. // rep(i,N){
  68. // dp[i+1] >?= dp[i];
  69. // dp[min(N,i+A[i][1]+1)] >?= dp[i] + A[i][0];
  70. // }
  71. // return dp[N];
  72. // }
  73. // };
  74.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty