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. int N;
  10. int cnt[26][100001];
  11. class Solution{
  12. public:
  13. vector<bool> canMakePaliQueries(string S, vector<vector<int>>& Q){
  14. int i, j, k;
  15. vector<bool> res;
  16. N = S.size();
  17. for(i=0;i<(N);i++){
  18. S[i] -= 'a';
  19. }
  20. for(k=0;k<(26);k++){
  21. cnt[k][0] = 0;
  22. for(i=0;i<(N);i++){
  23. cnt[k][i+1] = cnt[k][i];
  24. if(S[i]==k){
  25. cnt[k][i+1]++;
  26. }
  27. }
  28. }
  29. for(k=0;k<(Q.size());k++){
  30. i = 0;
  31. for(j=0;j<(26);j++){
  32. i += (cnt[j][Q[k][1]+1] - cnt[j][Q[k][0]]) % 2;
  33. }
  34. if(Q[k][2] >= i / 2){
  35. res.push_back(true);
  36. }
  37. else{
  38. res.push_back(false);
  39. }
  40. }
  41. return res;
  42. }
  43. }
  44. ;
  45. // cLay varsion 20190830-1
  46.  
  47. // --- original code ---
  48. // #define main dummy_main
  49. // {}
  50. // #undef main
  51. //
  52. // int N;
  53. // int cnt[26][100001];
  54. //
  55. // class Solution {
  56. // public:
  57. // vector<bool> canMakePaliQueries(string S, vector<vector<int>>& Q) {
  58. // int i, j, k;
  59. // vector<bool> res;
  60. //
  61. // N = S.size();
  62. // rep(i,N) S[i] -= 'a';
  63. // rep(k,26){
  64. // cnt[k][0] = 0;
  65. // rep(i,N){
  66. // cnt[k][i+1] = cnt[k][i];
  67. // if(S[i]==k) cnt[k][i+1]++;
  68. // }
  69. // }
  70. //
  71. // rep(k,Q.size()){
  72. // i = 0;
  73. // rep(j,26) i += (cnt[j][Q[k][1]+1] - cnt[j][Q[k][0]]) % 2;
  74. // if(Q[k][2] >= i / 2) res.push_back(true); else res.push_back(false);
  75. // }
  76. //
  77. // return res;
  78. // }
  79. // };
  80.  
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