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> invalidTransactions(vector<string>& in){
  12. char buf1[1000], buf2[1000];
  13. int N, amount[1000], i, j, tm[1000];
  14. string city[1000], name[1000];
  15. vector<string> res;
  16. N = in.size();
  17. for(i=0;i<(N);i++){
  18. sscanf(in[i].c_str(), "%[^,],%d,%d,%[^,]", buf1, tm+i, amount+i, buf2);
  19. name[i] = buf1;
  20. city[i] = buf2;
  21. }
  22. for(i=0;i<(N);i++){
  23. for(j=0;j<(N);j++){
  24. if(amount[i] > 1000 || (name[i]==name[j] && city[i]!=city[j] && abs(tm[j] - tm[i]) <= 60)){
  25. break;
  26. }
  27. }
  28. if(j!=N){
  29. res.push_back(in[i]);
  30. }
  31. }
  32. return res;
  33. }
  34. }
  35. ;
  36. // cLay varsion 20190829-1
  37.  
  38. // --- original code ---
  39. // #define main dummy_main
  40. // {}
  41. // #undef main
  42. //
  43. // class Solution {
  44. // public:
  45. // vector<string> invalidTransactions(vector<string>& in) {
  46. // int i, j, N;
  47. // string name[1000], city[1000];
  48. // int tm[1000], amount[1000];
  49. // char buf1[1000], buf2[1000];
  50. // vector<string> res;
  51. //
  52. // N = in.size();
  53. // rep(i,N){
  54. // sscanf(in[i].c_str(), "%[^,],%d,%d,%[^,]", buf1, tm+i, amount+i, buf2);
  55. // name[i] = buf1;
  56. // city[i] = buf2;
  57. // }
  58. //
  59. // rep(i,N){
  60. // rep(j,N) if(amount[i] > 1000 || (name[i]==name[j] && city[i]!=city[j] && abs(tm[j] - tm[i]) <= 60)) break;
  61. // if(j!=N) res.push_back(in[i]);
  62. // }
  63. //
  64. // return res;
  65. // }
  66. // };
  67.  
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