Submission #692996

# Submission time Handle Problem Language Result Execution time Memory
692996 2023-02-02T08:32:50 Z ktkerem Star triangles (IZhO11_triangle) C++17
100 / 100
448 ms 15544 KB
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
#include<bits/stdc++.h>
//typedef int ll;
typedef long long ll;
typedef unsigned long long ull;
#define llll std::pair<ll , ll>
#define pb push_back
#define pf push_front
#define halo cout << "hello" << std::endl
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e18+7; 
const ll ous = 2e5 + 500;
const ll dx[4] = {-1 , 0 , 1 , 0} , dy[4] = {0,1,0,-1};
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
ll n;
std::map<ll , ll> mpx , mpy;
std::vector<llll> ar;
void solve(){
    std::cin >> n;
    ar.resize(n);
    for(ll i = 0 ; n>i;i++){
        std::cin >> ar[i].fi >> ar[i].sec;
        mpx[ar[i].fi]++;
        mpy[ar[i].sec]++;
    }
    ll ans = 0;
    for(ll i = 0;n>i;i++){
        ans+=(mpx[ar[i].fi]-1) * (mpy[ar[i].sec]-1); 
    }
    std::cout << ans << "\n";
    return;/**/
}
signed main(){
    //std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);
    ll t=1;
    //std::cin >> t;
    ll o = 1;
    while(t--){ 
        //std::cout << "Case " << o << ": ";
        //o++;
        solve();        
    }
    return 0;
}/**/

Compilation message

triangle.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |                                                                               
triangle.cpp: In function 'int main()':
triangle.cpp:43:8: warning: unused variable 'o' [-Wunused-variable]
   43 |     ll o = 1;
      |        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 12 ms 1124 KB Output is correct
13 Correct 11 ms 1236 KB Output is correct
14 Correct 15 ms 1768 KB Output is correct
15 Correct 155 ms 7920 KB Output is correct
16 Correct 184 ms 8328 KB Output is correct
17 Correct 149 ms 7840 KB Output is correct
18 Correct 146 ms 7884 KB Output is correct
19 Correct 418 ms 14768 KB Output is correct
20 Correct 304 ms 11828 KB Output is correct
21 Correct 443 ms 15436 KB Output is correct
22 Correct 448 ms 15544 KB Output is correct