# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
886830 | karimov | Star triangles (IZhO11_triangle) | C++17 | 445 ms | 29652 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fio(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout)
void YES(bool t=1){std::cout<<(t?"YES\n":"NO\n");}
void NO(bool t=1){YES(!t);}
const int MOD = 1000000007;
#define int long long
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
void solve() {
int n; cin >> n;
map<int,int> a,b;
map<pair<int,int>,bool> mp;
int cnt=0;
while(n--) {
int x,y;
cin >> x >> y;
a[x]++;
b[y]++;
mp[{x,y}]=true;
}
for(auto it : mp){
cnt+=(a[it.first.first]-1)*(b[it.first.second]-1);
}
cout<<cnt;
}
signed main() {
FAST
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |