#include <iostream>
#include <vector>
#include <fstream>
#include <cstring>
#include <string>
#include <queue>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <cfloat>
#include <random>
#include <complex>
#include<assert.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int k;
cin >> k;
vector<pair<int, int> > g;
for(int i = 0; i < k; ++i) {
int n;
cin >> n;
set<int> q;
int cnt = 0;
for(int j = 0; j < n; ++j) {
int x; cin >> x;
if(q.count(x)) continue;
q.insert(x);
g.push_back({x, i + 1});
}
}
sort(g.rbegin(), g.rend());
for(int i = 0; i < g.size() - 2; ++i) {
if(g[i].second == g[i + 1].second) continue;
int j = i + 2;
//cout << g[i].first << " " << g[i + 1].first << " " << g[j].first << endl;
if(g[i + 1].first + g[j].first > g[i].first) {
int c1 = g[i].second, c2 = g[i + 1].second, c3 = g[j].second;
//cout << "c : " << c1 << " " << c2 << " " << c3 << endl;
if(c1 != c2 && c1 != c3 && c2 != c3) {
cout << c1 << ' ' << g[i].first << ' ' << c2 << ' ' << g[i + 1].first << ' ' << c3 << ' ' << g[j].first;
exit(0);
}
}
while(j < g.size()) {
//cout << g[i].first << " " << g[i + 1].first << " " << g[j + 1].first << endl;
if(g[i + 1].first + g[j + 1].first > g[i].first) {
int c1 = g[i].second, c2 = g[i + 1].second, c3 = g[j + 1].second;
//cout << "c : " << c1 << " " << c2 << " " << c3 << endl;
if(c1 != c2 && c1 != c3 && c2 != c3) {
cout << c1 << ' ' << g[i].first << ' ' << c2 << ' ' << g[i + 1].first << ' ' << c3 << ' ' << g[j + 1].first;
exit(0);
}
}
else break;
j++;
}
}
cout << "NIE";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |