# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1109686 | Anar | 별들과 삼각형 (IZhO11_triangle) | C++14 | 231 ms | 22156 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <array>
#include <map>
#include <iterator>
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
int n, ans;
vi starx, stary;
vii star;
map <int, int> mpx;
map <int, int> mpy;
void preprocess() {
cin >> n;
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
starx.pb(x);
stary.pb(y);
star.pb({x, y});
}
sort(starx.begin(), starx.end());
sort(stary.begin(), stary.end());
}
void mainprocess() {
for (int i = 0; i < n; i++) {
mpx[starx[i]] ++;
mpy[stary[i]] ++;
}
for (int i = 0; i < n; i++) {
ans += (mpx[star[i].ff] - 1) * (mpy[star[i].ss] - 1);
}
}
signed main() {
fastio;
preprocess();
mainprocess();
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |