답안 #671664

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
671664 2022-12-13T12:45:02 Z ReLice 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
305 ms 12668 KB
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define ld long double
#define pb push_back
#define sz size()
#define fr first
#define sc second
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
void start(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
const ll mod=998244353;
const ll inf=1e18;
const ll N=1e5+10;
void solve(){
    ll n,i,mx=-1,mn=inf,x,y;
    cin>>n;
    vector <pair<ll,ll>> v;
    map<ll,ll> mpx,mpy;
    for(i=0;i<n;i++){
        cin>>x>>y;
        mpx[x]++;
        mpy[y]++;
        v.pb({x,y});
    }
    ll ans=0;
    for(auto i : v){
        ans+=((mpx[i.fr]-1)*(mpy[i.sc]-1));
    }
    cout<<ans<<endl;
}
signed main(){
    //  fre("divide");
    start();
    ll t=1;
    //cin>>t;
    while(t--) solve();
}

Compilation message

triangle.cpp: In function 'void solve()':
triangle.cpp:21:12: warning: unused variable 'mx' [-Wunused-variable]
   21 |     ll n,i,mx=-1,mn=inf,x,y;
      |            ^~
triangle.cpp:21:18: warning: unused variable 'mn' [-Wunused-variable]
   21 |     ll n,i,mx=-1,mn=inf,x,y;
      |                  ^~
triangle.cpp: In function 'void fre(std::string)':
triangle.cpp:11:27: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:11:64: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                                                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 280 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 6 ms 1108 KB Output is correct
13 Correct 6 ms 1104 KB Output is correct
14 Correct 9 ms 1492 KB Output is correct
15 Correct 97 ms 5840 KB Output is correct
16 Correct 104 ms 5928 KB Output is correct
17 Correct 97 ms 5844 KB Output is correct
18 Correct 96 ms 5884 KB Output is correct
19 Correct 270 ms 12668 KB Output is correct
20 Correct 200 ms 8460 KB Output is correct
21 Correct 280 ms 12548 KB Output is correct
22 Correct 305 ms 12608 KB Output is correct