Advertisement
zipdang04

sinhtest.cpp

Apr 19th, 2021 (edited)
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.07 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. /*
  4. #include <ext/pb_ds/assoc_container.hpp>
  5. #include <ext/pb_ds/tree_policy.hpp>
  6. using namespace __gnu_pbds;
  7. typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
  8. */
  9.  
  10. typedef long long ll;
  11. typedef long double ld;
  12. typedef vector<int> vi;
  13. typedef vector<ll> vl;
  14. typedef pair<int, int> pii;
  15. typedef pair<ll, ll> pll;
  16. typedef map<int, int> mii;
  17. typedef unordered_map<int, int> umii;
  18. typedef map<ll, ll> mll;
  19. typedef unordered_map<ll, ll> umll;
  20. template <class T1, class T2>
  21. void maximize(T1 &a, T2 b){
  22.     if (b > a) a = b;
  23. }
  24. template <class T1, class T2>
  25. void minimize(T1 &a, T2 b){
  26.     if (b < a) a = b;
  27. }
  28. template <class T>
  29. void read(T &number)
  30. {
  31.     bool negative = false;
  32.     register int c;
  33.     number = 0;
  34.     c = getchar();
  35.     if (c=='-'){
  36.         negative = true;
  37.         c = getchar();
  38.     }
  39.     for (; (c>47 && c<58); c=getchar())
  40.         number = number *10 + c - 48;
  41.     if (negative)
  42.         number *= -1;
  43. }
  44. template <class T, class ...Ts>
  45. void read(T &a, Ts& ... args){
  46.     read(a);
  47.     read(args...);
  48. }
  49.  
  50. /*
  51. struct Node
  52. {
  53.     int node, len;
  54.     Node() {node = len = 0;}
  55.     Node(int node, int len) {this -> node = node, this -> len = len;}
  56. };
  57. typedef vector<Node> vg;
  58. */
  59.  
  60. #define MAX 1000001
  61. #define MOD 1000000007
  62.  
  63. #define fi first
  64. #define se second
  65. #define pf push_front
  66. #define pb push_back
  67.  
  68. #define FOR(type, i, a, b) for(type i = (a); i <= (b); i++)
  69. #define FORD(type, i, b, a) for(type i = (b); i >= (a); i--)
  70.  
  71. #define testBit(n, bit) ((n >> bit) & 1)
  72. #define flipBit(n, bit) (n ^ (1ll << bit))
  73. #define cntBit(n) __builtin_popcount(n)
  74. #define cntBitll(n) __builtin_popcountll(n)
  75. #define randomize mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
  76. randomize;
  77.  
  78. const string prob = "";
  79. const char LTRS[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  80.  
  81. string str2int(int num){
  82.     string s = "";
  83.     while (num)
  84.         s = char(num % 10 + '0') + s,
  85.         num /= 10;
  86.     while (s.length() < 3) s = '0' + s;
  87.     return s;
  88. }
  89. inline ll getNum(ll l, ll r){ return l + mt() % (r - l + 1); }
  90. inline ll getNum(ll n){ return getNum(1, n); }
  91. inline string getString(ll len){
  92.     string ans = "";
  93.     for (int i = 1; i <= len; i++) ans += LTRS[mt() % 52];
  94.     return ans;
  95. }
  96.  
  97. ll begTest, endTest, lim;
  98. void print(){
  99.     int n = mt() % lim + 1;
  100.     cout << n << '\n';
  101.     FOR(int, i, 1, n){
  102.         int num = mt() % 1000001;
  103.         num *= (mt() & 1) ? -1 : 1;
  104.         cout << num << ' ';
  105.     }
  106. }
  107.  
  108. main()
  109. {
  110.     ios_base::sync_with_stdio(0); cin.tie(0);
  111.     cin >> begTest >> endTest >> lim;
  112.     FOR(int, test, begTest, endTest){
  113.         cerr << test << '\n';
  114.         string dir = "TEST" + str2int(test);
  115.         string fileInp = dir + "/" + prob + ".inp";
  116.         string fileOut = dir + "/" + prob + ".out";
  117.         system(("mkdir " + dir).c_str());
  118.         freopen(fileInp.c_str(), "w", stdout);
  119.  
  120.         print();
  121.  
  122.         cout.flush(); fclose(stdin);
  123.         system((prob + " < " + fileInp + " > " + fileOut).c_str());
  124.         // system(("python " + prob + ".py < " + fileInp + " > " + fileOut).c_str());
  125.     }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement