Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- int x;
- scanf("%d", &x);
- vector<int> A,B,C,D,E,F;
- int soma=0;
- for(int a=0; a<4*x; a++){
- int m;
- scanf("%d", &m);
- if(a%4==0){
- A.push_back(m);
- }
- else if(a%4==1){
- B.push_back(m);
- }
- else if(a%4==2){
- C.push_back(m);
- }
- else if(a%4==3){
- D.push_back(m);
- }
- }
- for(int b=0; b<x; b++){
- for(int c=0; c<x;c++){
- E.push_back(A[b]+B[c]);
- }
- }
- for(int d=0; d<x; d++){
- for(int e=0; e<x; e++){
- F.push_back(C[d]+D[e]);
- }
- }
- for(int f=0; f<x*x-1; f++){
- sort(E.begin(),E.end());
- }
- for(int g=0; g<x*x-1; g++){
- sort(F.begin(), F.end());
- }
- for(int m=0; m<x*x; m++){
- if(binary_search(F.begin(), F.end(), -E[m])){
- soma += upper_bound(F.begin(), F.end(), -E[m]) - lower_bound(F.begin(), F.end(), -E[m]);
- }
- }
- printf("%d\n", soma);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement