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. vector<int> findNumOfValidWords(vector<string>& words, vector<string>& puzzles){
  12. int ans, c, i, j, k, q;
  13. map<int,int> mp;
  14. vector<int> res;
  15. mp.clear();
  16. for(k=0;k<(words.size());k++){
  17. j = 0;
  18. for(i=0;i<(words[k].size());i++){
  19. c = words[k][i] - 'a';
  20. j |= (1<<c);
  21. }
  22. mp[j]++;
  23. }
  24. for(q=0;q<(puzzles.size());q++){
  25. string s=puzzles[q];
  26. ans = 0;
  27. for(i=0;i<(7);i++){
  28. s[i] -= 'a';
  29. }
  30. for(i=0;i<(1<<6);i++){
  31. k = (1<<s[0]);
  32. for(j=0;j<(6);j++){
  33. if(i&1<<j){
  34. k |= (1<<s[j+1]);
  35. }
  36. }
  37. ans += mp[k];
  38. }
  39. res.push_back(ans);
  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. // class Solution {
  53. // public:
  54. // vector<int> findNumOfValidWords(vector<string>& words, vector<string>& puzzles) {
  55. // int i, j, k, c, q, ans;
  56. // map<int,int> mp;
  57. // vector<int> res;
  58. //
  59. // mp.clear();
  60. // rep(k,words.size()){
  61. // j = 0;
  62. // rep(i,words[k].size()){
  63. // c = words[k][i] - 'a';
  64. // j |= (1<<c);
  65. // }
  66. // mp[j]++;
  67. // }
  68. //
  69. // rep(q,puzzles.size()){
  70. // string s = puzzles[q];
  71. // ans = 0;
  72. //
  73. // rep(i,7) s[i] -= 'a';
  74. //
  75. // rep(i,1<<6){
  76. // k = (1<<s[0]);
  77. // rep(j,6) if(i&1<<j) k |= (1<<s[j+1]);
  78. // ans += mp[k];
  79. // }
  80. //
  81. // res.push_back(ans);
  82. // }
  83. //
  84. // return res;
  85. // }
  86. // };
  87.  
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