답안 #171349

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171349 2019-12-28T11:25:13 Z ASDF123 별들과 삼각형 (IZhO11_triangle) C++14
0 / 100
3 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
#define all(s) s.begin(), s.end()	
#define szof(s) (int)s.size()
#define pii pair<int, int>
#define prev myyyyrza1
#define pb push_back
#define y1 myyyyrza2
#define id id1234
#define fr first
#define sc second
#define OK() puts("OK")
using namespace std;
 
const int N = ((int)3e5 + 5);
const int MOD = (1e9 + 7);
const int INF = (0x3f3f3f3f);

int X[N], Y[N];

map <int, long long> cntx, cnty;

main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%d%d", &X[i], &Y[i]);
		cnty[Y[i]]++;
		cntx[X[i]]++;
	}
	
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		int x = X[i], y = Y[i];
		ans += (cntx[y] - 1LL) * (cnty[x] - 1LL);
	}
	cout << ans;
}

Compilation message

triangle.cpp:23:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
triangle.cpp: In function 'int main()':
triangle.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &X[i], &Y[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 3 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -