官方题解https://codeforc.es/blog/entry/90477
代码:
#include "bits/stdc++.h"
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int q;
cin >> q;
while (q--) {
int n; cin >> n;
int x = 1e9 + 7, pos = -1;
for (int i = 0; i < n; ++i) {
int a; cin >> a;
if (a < x) x = a, pos = i;
}
cout << n - 1 << endl;
for (int i = 0; i < n; ++i) {
if (i == pos) continue;
cout << pos + 1 << ' ' << i + 1 << ' ' << x << ' ' << x + abs(i - pos) << "\n";
}
}
}