시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 256 MB 4260 765 462 17.998%

문제

정수로 이루어진 크기가 같은 배열 A, B, C, D가 있다.

A[a], B[b], C[c], D[d]의 합이 0인 (a, b, c, d) 쌍의 개수를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 배열의 크기 n (1 ≤ n ≤ 4000)이 주어진다. 다음 n개 줄에는 A, B, C, D에 포함되는 정수가 공백으로 구분되어져서 주어진다. 배열에 들어있는 정수의 절대값은 최대 228이다.

출력

합이 0이 되는 쌍의 개수를 출력한다.

예제 입력 1

6
-45 22 42 -16
-41 -27 56 30
-36 53 -37 77
-36 30 -75 -46
26 -38 -10 62
-32 -54 -6 45

예제 출력 1

5
W3sicHJvYmxlbV9pZCI6Ijc0NTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQ1NjlcdWM3NzQgMFx1Yzc3OCBcdWIxMjQgXHVjODE1XHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWM4MTVcdWMyMThcdWI4NWMgXHVjNzc0XHViOGU4XHVjNWI0XHVjOWM0IFx1ZDA2Y1x1YWUzMFx1YWMwMCBcdWFjMTlcdWM3NDAgXHViYzMwXHVjNWY0IEEsIEIsIEMsIERcdWFjMDAgXHVjNzg4XHViMmU0LjxcL3A+XHJcblxyXG48cD5BW2FdLCBCW2JdLCBDW2NdLCBEW2RdXHVjNzU4Jm5ic3A7XHVkNTY5XHVjNzc0IDBcdWM3NzgmbmJzcDsoYSwgYiwgYywgZCkgXHVjMzBkXHVjNzU4IFx1YWMxY1x1YzIxOFx1Yjk3YyBcdWFkNmNcdWQ1NThcdWIyOTQgXHVkNTA0XHViODVjXHVhZGY4XHViN2E4XHVjNzQ0IFx1Yzc5MVx1YzEzMVx1ZDU1OFx1YzJkY1x1YzYyNC48XC9wPlxyXG4iLCJpbnB1dCI6IjxwPlx1Y2NhYlx1YzlmOCBcdWM5MDRcdWM1ZDAgXHViYzMwXHVjNWY0X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xdWFkcnVwbGV0IChhLCBiLCBjLCBkICkgJmlzaW47IEEgeCBCIHggQyB4IEQgYXJlIHN1Y2ggdGhhdCBhICsgYiArIGMgKyBkID0gMCAuIEluIHRoZSBmb2xsb3dpbmcsIHdlIGFzc3VtZSB0aGF0IGFsbCBsaXN0cyBoYXZlIHRoZSBzYW1lIHNpemUgbi48XC9wPlxyXG4iLCJpbnB1dCI6IjxwPlRoZSBmaXJzdCBsaW5lIG9mIHRoZSBpbnB1dCBjb250YWlucyB0aGUgc2l6ZSBvZiB0aGUgbGlzdHMgbiAodGhpcyB2YWx1ZSBjYW4gYmUgYXMgbGFyZ2UgYXMgNDAwMCkuIFdlIHRoZW4gaGF2ZSBuIGxpbmVzIGNvbnRhaW5pbmcgZm91ciBpbnRlZ2VyIHZhbHVlcyAod2l0aCBhYnNvbHV0ZSB2YWx1ZSBhcyBsYXJnZSBhcyAyMjgpIHRoYXQgYmVsb25nIHJlc3BlY3RpdmVseSB0byBBLCBCLCBDIGFuZCBEIC48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCBpbnB1dCwgeW91ciBwcm9ncmFtIGhhcyB0byB3cml0ZSB0aGUgbnVtYmVyIHF1YWRydXBsZXRzIHdob3NlIHN1bSBpcyB6ZXJvLjxcL3A+XHJcblxyXG48cD4mbmJzcDs8XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

ACM-ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 2005 E번

  • 어색한 표현을 찾은 사람: 79brue
  • 문제를 번역한 사람: baekjoon
  • 데이터를 추가한 사람: naong606