fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. template<class S, class T> inline S max_L(S a,T b){
  5. return a>=b?a:b;
  6. }
  7. #define main dummy_main
  8. int main(){
  9. return 0;
  10. }
  11. #undef main
  12. class Solution{
  13. public:
  14. int maxSatisfaction(vector<int>& A){
  15. int i;
  16. int now = 0;
  17. int res = 0;
  18. int N = A.size();
  19. sort(A.begin(), A.end());
  20. for(i=(N)-1;i>=(0);i--){
  21. now += A[i];
  22. res +=max_L(0, now);
  23. }
  24. return res;
  25. }
  26. }
  27. ;
  28. // cLay varsion 20200408-1
  29.  
  30. // --- original code ---
  31. // #define main dummy_main
  32. // {}
  33. // #undef main
  34. //
  35. // class Solution {
  36. // public:
  37. // int maxSatisfaction(vector<int>& A) {
  38. // int now = 0, res = 0, N = A.size();
  39. // sort(A.begin(), A.end());
  40. // rrep(i,N){
  41. // now += A[i];
  42. // res += max(0, now);
  43. // }
  44. // return res;
  45. // }
  46. // };
  47.  
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