This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
vector <int> v[51];
int n;
int find(int c,int num){
int l=0,r=v[c].size()-1,j=-1;
while(l<=r){
int k=(l+r)/2;
if(v[c][k]<=num){
j=v[c][k];
l=k+1;
}
else r=k-1;
}
return j;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int k;
cin>>k;
for(int c=0;c<k;c++){
cin>>n;
v[c].resize(n);
for(int i=0;i<n;i++) cin>>v[c][i];
sort(v[c].begin(),v[c].end());
}
for(int c=0;c<k;c++){
for(int i:v[c]){
vector <array<int,2>> valid;
for(int c2=0;c2<k;c2++){
if(c2!=c){
int a=find(c2,i);
if(a!=-1){
valid.push_back({c2,a});
}
}
}
sort(valid.begin(),valid.end());
int l=valid.size();
if(valid.size()>=2&&valid[l-1][1]+valid[l-2][1]>i){
cout<<c+1<<" "<<i<<" "<<valid[l-1][0]+1<<" "<<valid[l-1][1]<<" "<<valid[l-2][0]+1<<" "<<valid[l-2][1]<<endl;
exit(0);
}
}
}
cout<<"NIE"<<endl;
return 0;
}
# | 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... |