Submission #971244

# Submission time Handle Problem Language Result Execution time Memory
971244 2024-04-28T08:35:43 Z Aika Star triangles (IZhO11_triangle) C++14
0 / 100
0 ms 348 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]]);
	}
	cout<<ans/2;
}

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;
      |                ^~~~
# Verdict Execution time Memory 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -