# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
974974 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 940 ms | 34548 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i = 1; i<=n; i++)
#define fi first
#define sc second
using namespace std;
int main(){
map<ll,ll> mpx,mpy;
map<pair<ll,ll>, ll> mpdup;
ll n;
cin >> n;
pair<ll,ll> arr[n+99];
forn(i,n){
ll x,y;
cin >> x >> y;
mpx[x]++;
mpy[y]++;
mpdup[{x,y}]++;
arr[i] = {x,y};
}
ll sum = 0;
forn(i,n){
ll x = arr[i].fi,y = arr[i].sc;
if(mpdup[{x,y}] == 0)continue;
ll dup = mpdup[{x,y}];
if(mpdup[{x,y}] == 1){
sum += (mpx[x]-1) * (mpy[y]-1);
}else{
sum += (mpx[x] - dup )*(mpy[y] - dup )*(dup);
}
mpdup[{x,y}] = 0;
}
cout<<sum;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |