| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1306995 | abyfu | Star triangles (IZhO11_triangle) | C++20 | 250 ms | 7036 KiB |
//OwO
//#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define namein "input.txt"
#define nameout "output.txt"
#define pque priority_queue
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define pb push_back
#define m_pi acos(-1)
using namespace std;
const ll inf = 4e18;
const int linf = 1.5e9;
void file(){
if (fopen(namein, "r")){
freopen(namein, "r", stdin);
freopen(nameout, "w", stdout);
}
}
const ll mod = 1e9 + 7;
const int N = 3e5 + 5, M = 5e1 + 5;
map<ll, ll> x, y;
int a[N], b[N];
void run(){
int n; cin >> n;
for (int i = 1; i <= n; i++){
cin >> a[i] >> b[i];
x[a[i]]++; y[b[i]]++;
}
ll as = 0;
for (int i = 1; i <= n; i++){
as += (x[a[i]] - 1)*(y[b[i]] - 1);
//cout << (x[a[i]] - 1)*(y[b[i]] - 1) << " " << a[i] << " " << b[i] << "\n";
}
cout << as;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
file();
run();
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
