fork download
  1. #include <bits/stdc++.h>
  2. #define rep(i,a,b) for (int i=a; i<b; i++)
  3. #define pb push_back
  4. #define mp make_pair
  5. #define fi first
  6. #define se second
  7. #define debug printf
  8. using namespace std;
  9. typedef long long ll;
  10. typedef long double ld;
  11.  
  12. const int MX = (int)1e5 + 5;
  13.  
  14. map < int, int > skala;
  15. int reskala[MX];
  16.  
  17. int main ()
  18. {
  19. int n, k;
  20. scanf("%d%d", &n, &k);
  21. for(int i = 1; i <= k; ++i)
  22. {
  23. int t;
  24. for(int j = 1; j <= t; ++j)
  25. {
  26. int a;
  27. scanf("%d", &a);
  28. V[i].pb(a);
  29. S.pb(a);
  30. }
  31. }
  32. sort(all(S));
  33. for(int i = 0; i < N; ++i)
  34. {
  35. skala[S[i]] = i;
  36. reskala[i] = S[i];
  37. }
  38. for(int i = 1; i <= k; ++i)
  39. for(auto &v : V[i])
  40. v = skala[v];
  41. vector < PII > ans;
  42. for(int i = 1; i < k; ++i)
  43. {
  44. while(V[i].size())
  45. {
  46. ans.pb({i, k});
  47. V[k].pb(V[i].back());
  48. V[i].pop_back();
  49. }
  50. }
  51. p10[0] = 1;
  52. for(int i = 1; i < 10; ++i)
  53. p10[i] = 10 * p10[i - 1];
  54. for(int cyf = 4; cyf >= 0; --cyf)
  55. {
  56. while(V[k].size())
  57. {
  58. int gdzie = 1 + ((V[k].back() / p10[cyf]) % 10);
  59. ans.pb({k, gdzie});
  60. V[gdzie].pb(V[k].back());
  61. V[k].pop_back();
  62. }
  63. for(int
  64. }
  65.  
  66. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:28:4: error: ‘V’ was not declared in this scope
    V[i].pb(a);
    ^
prog.cpp:29:4: error: ‘S’ was not declared in this scope
    S.pb(a);
    ^
prog.cpp:32:11: error: ‘S’ was not declared in this scope
  sort(all(S));
           ^
prog.cpp:32:7: error: ‘all’ was not declared in this scope
  sort(all(S));
       ^~~
prog.cpp:32:7: note: suggested alternative: ‘ll’
  sort(all(S));
       ^~~
       ll
prog.cpp:33:21: error: ‘N’ was not declared in this scope
  for(int i = 0; i < N; ++i)
                     ^
prog.cpp:39:17: error: ‘V’ was not declared in this scope
   for(auto &v : V[i])
                 ^
prog.cpp:41:11: error: ‘PII’ was not declared in this scope
  vector < PII > ans;
           ^~~
prog.cpp:41:15: error: template argument 1 is invalid
  vector < PII > ans;
               ^
prog.cpp:41:15: error: template argument 2 is invalid
prog.cpp:44:9: error: ‘V’ was not declared in this scope
   while(V[i].size())
         ^
prog.cpp:3:12: error: request for member ‘push_back’ in ‘ans’, which is of non-class type ‘int’
 #define pb push_back
            ^~~~~~~~~
prog.cpp:46:8: note: in expansion of macro ‘pb’
    ans.pb({i, k});
        ^~
prog.cpp:51:2: error: ‘p10’ was not declared in this scope
  p10[0] = 1;
  ^~~
prog.cpp:56:9: error: ‘V’ was not declared in this scope
   while(V[k].size())
         ^
prog.cpp:3:12: error: request for member ‘push_back’ in ‘ans’, which is of non-class type ‘int’
 #define pb push_back
            ^~~~~~~~~
prog.cpp:59:8: note: in expansion of macro ‘pb’
    ans.pb({k, gdzie});
        ^~
prog.cpp:64:2: error: expected unqualified-id before ‘}’ token
  }
  ^
prog.cpp:63:10: error: expected ‘;’ before ‘}’ token
   for(int
          ^
          ;
  }
  ~        
prog.cpp:64:2: error: expected primary-expression before ‘}’ token
  }
  ^
prog.cpp:63:10: error: expected ‘;’ before ‘}’ token
   for(int
          ^
          ;
  }
  ~        
prog.cpp:64:2: error: expected primary-expression before ‘}’ token
  }
  ^
prog.cpp:63:10: error: expected ‘)’ before ‘}’ token
   for(int
      ~   ^
          )
  }
  ~        
prog.cpp:64:2: error: expected primary-expression before ‘}’ token
  }
  ^
prog.cpp:20:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~
prog.cpp:27:9: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &a);
    ~~~~~^~~~~~~~~~
stdout
Standard output is empty