fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. template<class S, class T> inline S chmax(S &a, T b){
  5. if(a<b){
  6. a=b;
  7. }
  8. return a;
  9. }
  10. #define main dummy_main
  11. int main(){
  12. return 0;
  13. }
  14. #undef main
  15. int c[100000];
  16. class Solution{
  17. public:
  18. int equalSubstring(string s, string t, int mx){
  19. int i;
  20. int j;
  21. int k;
  22. int N = s.size();
  23. int res = 0;
  24. for(i=(0);i<(N);i++){
  25. c[i] = abs(s[i]-t[i]);
  26. }
  27. j = k = 0;
  28. for(i=(0);i<(N);i++){
  29. while(j < N && k + c[j] <= mx){
  30. k += c[j++];
  31. }
  32. chmax(res, j - i);
  33. k -= c[i];
  34. }
  35. return res;
  36. }
  37. }
  38. ;
  39. // cLay varsion 20191006-1
  40.  
  41. // --- original code ---
  42. // #define main dummy_main
  43. // {}
  44. // #undef main
  45. //
  46. // int c[1d5];
  47. //
  48. // class Solution {
  49. // public:
  50. // int equalSubstring(string s, string t, int mx) {
  51. // int i, j, k, N = s.size(), res = 0;
  52. // rep(i,N) c[i] = abs(s[i]-t[i]);
  53. // j = k = 0;
  54. // rep(i,N){
  55. // while(j < N && k + c[j] <= mx) k += c[j++];
  56. // res >?= j - i;
  57. // k -= c[i];
  58. // }
  59. // return res;
  60. // }
  61. // };
  62.  
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