#include <bits/stdc++.h>
#define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define co cout<<
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #pragma GCC target("avx2,sse3,sse4,avx")
using namespace std;
//stuff
ll n;
pair<ll,ll>arr[3000001];
ll cnt=0;
void solve(){
cin>>n;
for(int i=1;i<=n;i++){
ll x;
cin>>x;
for(int j=0;j<x;j++){
ll y;
cin>>y;
arr[cnt]={y,i};
cnt++;
}
}
sort(arr,arr+cnt);
for(int i=0;i<cnt;i++) swap(arr[i].first,arr[i].second);
ll i,j,k;
j=k=0;
while(arr[k].first==arr[j].first&&j<cnt) j++;
i=j;
while((arr[j].first==arr[i].first||arr[i].first==arr[k].first)&&i<cnt) i++;
if(i>=cnt||j>=cnt||k>=cnt){
co "NIE";
return;
}
while(1){
ll a,b,c;
a=arr[i].second;
b=arr[j].second;
c=arr[k].second;
if(a+b>c&&a+c>b&&c+b>a){
co arr[i].first<<' '<<a<<' '<<arr[j].first<<' '<<b<<' '<<arr[k].first<<' '<<c;
return;
}
if(i+1>=cnt) break;
if(arr[i].first==arr[i+1].first){
i++;
}
else{
if(arr[i+1].first==arr[j].first){
j=i;
i++;
}
else{
k=j;
j=i;
i++;
}
}
}
co "NIE";
}
int main()
{
suiii
int tt=1;
// cin>>tt;
while(tt--){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Oczekiwano NIE |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Oczekiwano NIE |
2 |
Incorrect |
3 ms |
1112 KB |
Expected integer, but "NIE" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Oczekiwano NIE |
2 |
Incorrect |
5 ms |
1372 KB |
Expected integer, but "NIE" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Oczekiwano NIE |
2 |
Incorrect |
14 ms |
2660 KB |
Expected integer, but "NIE" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
860 KB |
Oczekiwano NIE |
2 |
Incorrect |
20 ms |
4008 KB |
Expected integer, but "NIE" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1880 KB |
Oczekiwano NIE |
2 |
Correct |
35 ms |
6584 KB |
Output is correct |
3 |
Correct |
18 ms |
3928 KB |
Oczekiwano NIE |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
68 ms |
12884 KB |
Output is correct |
2 |
Incorrect |
41 ms |
8304 KB |
Expected integer, but "NIE" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
76 ms |
12884 KB |
Output is correct |
2 |
Correct |
45 ms |
9044 KB |
Output is correct |
3 |
Correct |
38 ms |
7512 KB |
Oczekiwano NIE |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
139 ms |
25588 KB |
Output is correct |
2 |
Correct |
53 ms |
10324 KB |
Output is correct |
3 |
Correct |
54 ms |
10832 KB |
Oczekiwano NIE |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
147 ms |
25680 KB |
Output is correct |
2 |
Correct |
59 ms |
11856 KB |
Output is correct |
3 |
Correct |
76 ms |
13096 KB |
Oczekiwano NIE |