답안 #381531

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381531 2021-03-25T09:29:24 Z ismoilov 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
405 ms 13292 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
const int MAXX = 3e5+5;
int x[MAXX], y[MAXX];
	map <ll, ll> a, b;
void S()
{
	ll n, ans = 0;
	cin >> n;
	fpp(i,1,n)
	{
		cin >> x[i] >> y[i];
		a[x[i]]++;
		b[y[i]]++;
	}
	fpp(i,1,n)
	{
		ans += 1LL * (a[x[i]]-1)*(b[y[i]]-1);
	}
	cout << ans;
}
int main()
{
	IOS;
	S();
}

Compilation message

triangle.cpp: In function 'void S()':
triangle.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
triangle.cpp:17:2: note: in expansion of macro 'fpp'
   17 |  fpp(i,1,n)
      |  ^~~
triangle.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
triangle.cpp:23:2: note: in expansion of macro 'fpp'
   23 |  fpp(i,1,n)
      |  ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 2 ms 492 KB Output is correct
12 Correct 8 ms 1260 KB Output is correct
13 Correct 7 ms 1260 KB Output is correct
14 Correct 12 ms 1772 KB Output is correct
15 Correct 147 ms 7232 KB Output is correct
16 Correct 159 ms 7660 KB Output is correct
17 Correct 132 ms 7224 KB Output is correct
18 Correct 140 ms 7148 KB Output is correct
19 Correct 380 ms 12652 KB Output is correct
20 Correct 265 ms 10348 KB Output is correct
21 Correct 386 ms 13292 KB Output is correct
22 Correct 405 ms 13292 KB Output is correct