답안 #420253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
420253 2021-06-08T08:28:55 Z cpp219 별들과 삼각형 (IZhO11_triangle) C++14
0 / 100
1 ms 204 KB
#pragma GCC optimization "O2"
#pragma GCC optimization "unroll-loop"
#pragma GCC target ("avx2")

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
using namespace std;
const ll N = 3e5 + 9;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;
map<ll,ll> mpx,mpy;
ll n,ans;
LL a[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define task "test"
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>n;
    for (ll i = 1;i <= n;i++){
        cin>>a[i].fs>>a[i].sc;
        mpx[a[i].fs]++; mpy[a[i].sc]++;
    }
    for (ll i = 1;i <= n;i++){
        ll p = mpx[a[i].fs] - 1,q = mpy[a[i].sc] - 1;
        ans -= p*q;
    }
    cout<<ans;
}

Compilation message

triangle.cpp:1: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    1 | #pragma GCC optimization "O2"
      | 
triangle.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization "unroll-loop"
      | 
triangle.cpp: In function 'int main()':
triangle.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -