• the meaning of problems
You k sequences, the i-th sequence containing n- i elements;
Ask if there are two different sequences i, j;
The sum of i satisfying remove a sequence number is equal to the sum of the sequence j deleted after a certain number;
• problem solution
定义 map<int , pair<int ,int > >f;
For convenience of description, the above definition to map <x, pair <y, z>> f;
It represents the sum of the sequence y deleted after the number of first z x;
For the i-th sequence, after deleting the first number j, determines the sum cur after deletion;
F cur determining whether there is, if there is output directly, whereas keep looking;
•Code
View Code1 #include<bits/stdc++.h> 2 using namespace std; 3 #define pii pair<int ,int > 4 const int maxn=2e5+50; 5 6 int k; 7 int a[maxn]; 8 map<int ,pii >f; 9 10 int main() 11 { 12 scanf("%d",&k); 13 for(int i=1;i <= k;++i) 14 { 15 int n; 16 scanf("%d",&n); 17 18 int sum=0; 19 for(int j=1;j <= n;++j) 20 { 21 scanf("%d",a+j); 22 sum += a[j]; 23 } 24 25 for(int j=1;j <= n;++j) 26 { 27 int CUR sum- = A [J]; 28 29 /// sequence before determining whether there is a CUR 30 /// ! F [CUR] .first is necessary I = 31 /// test sample can be understood as follows 32 / * * 33 is . 1 34 is 2 35 . 1. 1 36 * / 37 [ IF (! f.count (CUR) && F [CUR] .first = I) 38 is { 39 the puts ( " YES " ); 40 PII tmp = F [ CUR]; 41 is the printf ("%d %d\n",i,j); 42 printf("%d %d\n",tmp.first,tmp.second); 43 return 0; 44 } 45 f[cur]=pii(i,j); 46 } 47 } 48 puts("NO"); 49 50 return 0; 51 }