fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. template<class S, class T> inline S min_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. vector<int> arraysIntersection(vector<int>& A, vector<int>& B, vector<int>& C){
  15. int a = 0;
  16. int b = 0;
  17. int c = 0;
  18. int m;
  19. vector<int> res;
  20. while(a < A.size() && b < B.size() && c < C.size()){
  21. if(A[a] == B[b] && B[b] == C[c]){
  22. res.push_back(A[a]);
  23. a++;
  24. b++;
  25. c++;
  26. }
  27. else{
  28. m =min_L(min_L(A[a], B[b]), C[c]);
  29. if(m==A[a]){
  30. a++;
  31. }
  32. if(m==B[b]){
  33. b++;
  34. }
  35. if(m==C[c]){
  36. c++;
  37. }
  38. }
  39. }
  40. return res;
  41. }
  42. }
  43. ;
  44. // cLay varsion 20191006-1
  45.  
  46. // --- original code ---
  47. // #define main dummy_main
  48. // {}
  49. // #undef main
  50. //
  51. // class Solution {
  52. // public:
  53. // vector<int> arraysIntersection(vector<int>& A, vector<int>& B, vector<int>& C) {
  54. // int a = 0, b = 0, c = 0, m;
  55. // vector<int> res;
  56. // while(a < A.size() && b < B.size() && c < C.size()){
  57. // if(A[a] == B[b] == C[c]){
  58. // res.push_back(A[a]);
  59. // a++; b++; c++;
  60. // } else {
  61. // m = min(A[a], B[b], C[c]);
  62. // if(m==A[a]) a++;
  63. // if(m==B[b]) b++;
  64. // if(m==C[c]) c++;
  65. // }
  66. // }
  67. // return res;
  68. // }
  69. // };
  70.  
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