| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 531864 | makanhulia | 별들과 삼각형 (IZhO11_triangle) | C++17 | 945 ms | 31176 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pairll pair<ll,ll>
#define lpairll pair<pairll,ll>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define repp(i,a,b) for(ll i = (a); i <= (b); i++)
#define repm(i, a, b) for (ll i = (a); i >= (b); i--)
#define repz(i, a, b) for (ll i = (a); i < (b); i++)
const long long MOD = 1e9+7, N = 3e5 + 5, Q = 4e3+5;
ll tc = 1, n, m=0,k, x[N], y[N];
string s, ye = "YES", no = "NO";
vector<ll> res;
map<pairll,ll> mapz;
map<ll,ll> frx,fry;
void fastt(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
void input(){
cin >> n;
repp(i,1,n){
cin >> x[i] >> y[i];
frx[x[i]]++;
fry[y[i]]++;
mapz[mp(x[i],y[i])]++;
}
}
void solve(){
ll ans = 0;
repp(i,1,n){
ll X = x[i], Y = y[i], sem;
sem = mapz[mp(X,Y)];
ans += (frx[X]-sem)*(fry[Y]-sem);
}
cout << ans << endl;
}
int main(){
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
fastt();
//cin >> tc;
while(tc--){
input();
solve();
}
}
/*
*/
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
