- #include "bits/stdc++.h"
- // #pragma GCC optimize("O3,unroll-loops")
- // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
- using namespace std;
- using ll = long long int;
- mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
-
- int main()
- {
- ios::sync_with_stdio(false); cin.tie(0);
-
- int n; cin >> n;
- vector<int> a(n+1);
- for (int i = 1; i <= n; ++i) cin >> a[i];
- struct op {
- vector<int> ind;
- int special, type;
- };
- vector<op> ops;
-
- for (int i = 1; i <= 20; ++i) {
- int mx = 0;
- for (int j = 1; j <= n; ++j) mx = max(mx, a[j]);
- op cur; cur.type = -1;
- int mn = 1e9;
- for (int j = 1; j <= n; ++j) {
- if (a[j] >= (mx+1)/2) {
- cur.ind.push_back(j);
- if (a[j] < mn) {
- mn = a[j];
- cur.special = j;
- }
- }
- }
- for (int j = 1; j <= n; ++j) {
- if (a[j] >= mn) a[j] -= mn;
- }
- ops.push_back(cur);
- }
-
- // for (int i = 1; i <= n; ++i) {
- // if (a[i] == 0) continue;
- // op cur;
- // cur.special = i;
- // cur.type = -1;
- // for (int j = i; j <= n; ++j) {
- // if (a[j] >= a[i]) {
- // a[j] -= a[i];
- // cur.ind.push_back(j);
- // }
- // }
- // ops.push_back(cur);
- // }
- cout << size(ops) << '\n';
- for (auto o : ops) {
- cout << size(o.ind) << '\n';
- for (int x : o.ind) cout << x << ' ';
- cout << '\n';
- if (o.type == 1) cout << "+ ";
- else cout << "- ";
- cout << o.special << '\n';
- }
- }