답안 #971245

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
971245 2024-04-28T08:38:07 Z Aika 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
262 ms 14604 KB
#include <bits/stdc++.h>
#define int long long
#define aiiiii ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

signed main(){
    aiiiii
    int n, i, j;
    cin>>n;
    int ans1=0,ans2=0;
    map<int,int>mp;
    map<int,int>mp1;
    int r[n],s[n];
    for(i=0;i<n;i++){
    	cin>>r[i]>>s[i];
    	mp[r[i]]++;
    	mp1[s[i]]++;
	}
	int ans=0;
	for(i=0;i<n;i++){
		ans+=(mp[r[i]]-1)*(mp1[s[i]]-1);
	}
	cout<<ans;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:8:15: warning: unused variable 'j' [-Wunused-variable]
    8 |     int n, i, j;
      |               ^
triangle.cpp:10:9: warning: unused variable 'ans1' [-Wunused-variable]
   10 |     int ans1=0,ans2=0;
      |         ^~~~
triangle.cpp:10:16: warning: unused variable 'ans2' [-Wunused-variable]
   10 |     int ans1=0,ans2=0;
      |                ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 456 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 7 ms 1300 KB Output is correct
13 Correct 5 ms 1372 KB Output is correct
14 Correct 8 ms 1884 KB Output is correct
15 Correct 85 ms 7760 KB Output is correct
16 Correct 96 ms 8400 KB Output is correct
17 Correct 87 ms 7760 KB Output is correct
18 Correct 85 ms 7908 KB Output is correct
19 Correct 244 ms 13652 KB Output is correct
20 Correct 169 ms 11048 KB Output is correct
21 Correct 262 ms 14604 KB Output is correct
22 Correct 249 ms 14360 KB Output is correct