Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
945 B
1
Indexable
Never
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;



int main(int argc, char *argv[]){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  srand(atoi(argv[1]));

  int n = 1e5;
  int q = 1e5;
  cout << n << ' ' << q << endl;
  for (int i = 0; i < n; ++i) cout << rand() % 2 + 1 << ' ';
  cout << endl;
  
  vector<pair<int, int> > ed;
  ed.pb(mp(1, 2));
  ed.pb(mp(1, 3));

  int dd = 4;
  int last = 1;

  int len = 2;
  while (1) {
  	if (len + 1 + dd - 1 > n) break;

  	int root = dd;
  	ed.pb(mp(last, dd++));


  	for (int j = 0; j < len; ++j) ed.pb(mp(dd - 1, dd++));

  	++len;
  	last = root;
  }

  while (dd <= n) {
  	ed.pb(mp(1, dd++));
  }

  while (q--) {
  	int u = rand() % n + 1;
  	int v = rand() % n + 1;
  	cout << "Q " << u << ' ' << v << ' ' << rand() % 2 + 1 << endl;
  }

}