Codeforces Round #486 (Div. 3) C. Equal Sums
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N],k,n;
vector<pair<int,pair<int,int>>> p;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
int sum=0;
scanf("%d",&k);
for(int j=1;j<=k;j++) scanf("%d",&a[j]),sum+=a[j];
for(int j=1;j<=k;j++)
{
p.push_back(sum-a[j],make_pair(i,j));
}
}
sort(p.begin(),p.end());
bool st=1;
for(int i=0;i<(int)p.size()-1;i++)
{
if(p[i].first==p[i+1].first&&p[i].second.first!=p[i+1].second.first)
{
st=0;
puts("YES");
printf("%d %d\n",p[i].second.first,p[i].second.second);
printf("%d %d\n",p[i+1].second.first,p[i+1].second.second);
break;
}
}
if(st) puts("NO");
return 0;
}