fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define main dummy_main
  5. int main(){
  6. return 0;
  7. }
  8. #undef main
  9. class Solution{
  10. public:
  11. int numOfSubarrays(vector<int>& A, int K, int threshold){
  12. int i;
  13. int res = 0;
  14. int N = A.size();
  15. long long s = 0;
  16. for(i=(0);i<(N);i++){
  17. A[i] -= threshold;
  18. }
  19. for(i=(0);i<(K);i++){
  20. s += A[i];
  21. }
  22. if(s >= 0){
  23. res++;
  24. }
  25. for(i=(K);i<(N);i++){
  26. s += A[i] - A[i-K];
  27. if(s >= 0){
  28. res++;
  29. }
  30. }
  31. return res;
  32. }
  33. }
  34. ;
  35. // cLay varsion 20200214-1
  36.  
  37. // --- original code ---
  38. // #define main dummy_main
  39. // {}
  40. // #undef main
  41. //
  42. // class Solution {
  43. // public:
  44. // int numOfSubarrays(vector<int>& A, int K, int threshold) {
  45. // int res = 0, N = A.size();
  46. // ll s = 0;
  47. // rep(i,N) A[i] -= threshold;
  48. //
  49. // rep(i,K) s += A[i];
  50. // if(s >= 0) res++;
  51. // rep(i,K,N){
  52. // s += A[i] - A[i-K];
  53. // if(s >= 0) res++;
  54. // }
  55. // return res;
  56. // }
  57. // };
  58.  
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