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 max_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 T, class S> int Count(const int N, const T A[], const S val){
  27. int i;
  28. int res = 0;
  29. for(i=(0);i<(N);i++){
  30. if(A[i]==val){
  31. res++;
  32. }
  33. }
  34. return res;
  35. }
  36. template<class T, class S> int Count(const vector<T> &A, const S val){
  37. int i;
  38. int res = 0;
  39. for(i=(0);i<(A.size());i++){
  40. if(A[i]==val){
  41. res++;
  42. }
  43. }
  44. return res;
  45. }
  46. template<class S> int Count(const string &A, const S val){
  47. int i;
  48. int res = 0;
  49. for(i=(0);i<(A.size());i++){
  50. if(A[i]==val){
  51. res++;
  52. }
  53. }
  54. return res;
  55. }
  56. #define main dummy_main
  57. int main(){
  58. return 0;
  59. }
  60. #undef main
  61. class Solution{
  62. public:
  63. long long minSum(vector<int> &A, vector<int> &B){
  64. int za = Count(A, 0);
  65. int zb = Count(B, 0);
  66. int Nzj9Y0kE;
  67. long long bkxOPzPX;
  68. int WKqLrJHZ = 0;
  69. if((0) > ((A.size())-1)){
  70. bkxOPzPX = 0;
  71. }
  72. else{
  73. for(Nzj9Y0kE = 0; Nzj9Y0kE <= (A.size())-1; Nzj9Y0kE++){
  74. if(WKqLrJHZ == 0){
  75. bkxOPzPX = A[Nzj9Y0kE];
  76. WKqLrJHZ = 1;
  77. continue;
  78. }
  79. bkxOPzPX += A[Nzj9Y0kE];
  80. }
  81. if(WKqLrJHZ==0){
  82. bkxOPzPX = 0;
  83. }
  84. }
  85. long long sa = bkxOPzPX+ za;
  86. int YGwFZBGH;
  87. long long OA9NF42T;
  88. int ATMZloZo = 0;
  89. if((0) > ((B.size())-1)){
  90. OA9NF42T = 0;
  91. }
  92. else{
  93. for(YGwFZBGH = 0; YGwFZBGH <= (B.size())-1; YGwFZBGH++){
  94. if(ATMZloZo == 0){
  95. OA9NF42T = B[YGwFZBGH];
  96. ATMZloZo = 1;
  97. continue;
  98. }
  99. OA9NF42T += B[YGwFZBGH];
  100. }
  101. if(ATMZloZo==0){
  102. OA9NF42T = 0;
  103. }
  104. }
  105. long long sb = OA9NF42T+ zb;
  106. if((za==0 && sa < sb) || (zb==0 && sb < sa)){
  107. return -1;
  108. }
  109. return max_L(sa, sb);
  110. }
  111. }
  112. ;
  113. // cLay version 20231031-1
  114.  
  115. // --- original code ---
  116. // #define main dummy_main
  117. // {}
  118. // #undef main
  119. //
  120. // class Solution {
  121. // public:
  122. // ll minSum(VI &A, VI &B){
  123. // int za = Count(A, 0);
  124. // int zb = Count(B, 0);
  125. // ll sa = sum[ll][i,0,A.size()](A[i]) + za;
  126. // ll sb = sum[ll][i,0,B.size()](B[i]) + zb;
  127. // if((za==0 && sa < sb) || (zb==0 && sb < sa)) return -1;
  128. // return max(sa,sb);
  129. // }
  130. // };
  131.  
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