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<string> removeSubfolders(vector<string>& S){
  12. int i;
  13. vector<string> res;
  14. set<string> st;
  15. int N = S.size();
  16. sort(S.begin(), S.end());
  17. for(i=(0);i<(N);i++){
  18. string tmp = S[i];
  19. while(tmp.size()){
  20. int j;
  21. for(j=(tmp.size())-1;j>=(0);j--){
  22. if(tmp[j]=='/'){
  23. break;
  24. }
  25. }
  26. tmp = tmp.substr(0,j);
  27. if(st.count(tmp)){
  28. break;
  29. }
  30. }
  31. if(tmp.size()==0){
  32. st.insert(S[i]);
  33. res.push_back(S[i]);
  34. }
  35. }
  36. return res;
  37. }
  38. }
  39. ;
  40. // cLay varsion 20191102-1
  41.  
  42. // --- original code ---
  43. // #define main dummy_main
  44. // {}
  45. // #undef main
  46. //
  47. // class Solution {
  48. // public:
  49. // vector<string> removeSubfolders(vector<string>& S) {
  50. // vector<string> res;
  51. // set<string> st;
  52. // int N = S.size();
  53. // sort(S.begin(), S.end());
  54. // rep(i,N){
  55. // string tmp = S[i];
  56. // while(tmp.size()){
  57. // rrep(j,tmp.size()) if(tmp[j]=='/') break;
  58. // tmp = tmp.substr(0,j);
  59. // if(st.count(tmp)) break;
  60. // }
  61. // if(tmp.size()==0) st.insert(S[i]), res.push_back(S[i]);
  62. // }
  63. // return res;
  64. // }
  65. // };
  66.  
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