-
Notifications
You must be signed in to change notification settings - Fork 0
/
C_Equal_Sums.cpp
96 lines (82 loc) · 1.93 KB
/
C_Equal_Sums.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <bits/stdc++.h>
#define lim 1000000007
#define rep(i,a,b,step) for(unsigned long long i=a;i<b;i+=step)
#define min(a,b) (a>b)?b:a
#define max(a,b) (a>b)?a:b
#define vecI vector<int>
#define vecB vector<bool>
#define vecL vector<long>
#define vecLL vector<long long>
#define vecUL vector<unsigned long>
#define vecULL vector<unsigned long long>
#define yes "YES"
#define no "NO"
using namespace std;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
template <typename T>
ostream &operator<<(ostream &os, vector<T> arr){
for (T i = 0; i < arr.size(); ++i){
os << arr[i] << " ";
}
return os;
}
void swap(int &a, int &b){
a = a ^ b;
b = a ^ b;
a = a ^ b;
}
vector<ull> fact(1000000,1);
void factorial(){
for (ull i = 2;i<1000000;i++){
fact[i] = i* fact[i-1];
}
}
void solve(){
int k;
cin>>k;
set <pair<int, pair<int,int>>> ans;
rep(i,0,k,1){
ull n;
ll q,summ=0;
cin>>n;
vecL seq;
while(n--){
cin>>q;
seq.push_back(q);
summ+=q;
}
rep(j,0,seq.size(),1){
ans.insert({summ-seq.at(j),{i+1,j+1}});
}
}
pair<int,pair<int,int>> prev = *(ans.begin());
bool is(true);
for(auto i : ans){
if(i== *(ans.begin())) continue;
if(i.first == prev.first && i.second.first != prev.second.first){
cout<<yes<<endl;
cout<<prev.second.first<<" "<<prev.second.second<<endl;
cout<<i.second.first<<" "<<i.second.second<<endl;
is = false;
break;
}else{
prev.first = i.first;
prev.second.first = i.second.first;
prev.second.second = i.second.second;
}
}
if (is){
cout<<no<<endl;
}
}
int main() {
unsigned int T;
// cin>>T;
T=1;
while(T--){
solve();
}
return 0;
}