# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1108150 | 2024-11-03T03:39:42 Z | Tsagana | 별들과 삼각형 (IZhO11_triangle) | C++17 | 4 ms | 592 KB |
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all(x) x.begin(), x.end() #define lnl long long #define pq priority_queue #define eb emplace_back #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define F first #define S second using namespace std; vector<pair<int, int>> vx; vector<pair<int, int>> vy; vector<pair<int, int>> p; int X[300001]; int Y[300001]; void solve () { int n; cin >> n; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; vx.pb({x, i}); vy.pb({y, i}); p.pb({x, y}); } sort(all(vx)); sort(all(vy)); int l = 0; p[vx[0].S].F = 0; for (int i = 1; i < n; i++) { if (vx[i].F != vx[i-1].F) l++; p[vx[i].S].F = l; } int r = 0; p[vy[0].S].S = 0; for (int i = 1; i < n; i++) { if (vy[i].F != vy[i-1].F) r++; p[vy[i].S].S = r; } for (auto i: p) { X[i.F]++; Y[i.S]++; } int ans = 0; for (auto i: p) { ans += (X[i.F]-1)*(Y[i.S]-1); } cout << ans; } signed main() { IOS #ifndef LOCAL freopen("triangles.in", "r", stdin); freopen("triangles.out", "w", stdout); #endif solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 592 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |