Submission #944473

# Submission time Handle Problem Language Result Execution time Memory
944473 2024-03-12T18:17:38 Z Zena_Hossam Star triangles (IZhO11_triangle) C++14
100 / 100
751 ms 37492 KB
#include <bits/stdc++.h>
using namespace std;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll double
#define ll long long
//#define ll1 long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int main()
{
   // freopen("measurement.in","r",stdin);freopen("measurement.out","w",stdout);
    ll T=1;
    //cin>>T;ll oo=0;
    while(T--)
    {
       ll n;
       cin>>n;
       pair<ll,ll>a[n];map<ll,map<ll,ll>>m;
       map<ll,ll>x,b;
       for(ll i=0;i<n;i++){
        cin>>a[i].first>>a[i].second;x[a[i].F]++;b[a[i].S]++;
        m[a[i].first][a[i].second]++;
       }ll c=0;
       for(ll i=0;i<n;i++){ll g=a[i].first,h=a[i].second;
        c+=(x[g]-1)*(b[h]-1)-(m[g][h]-1);
       }cout<<c;
    }
}

Compilation message

triangle.cpp:5: warning: "ll" redefined
    5 | #define ll long long
      | 
triangle.cpp:4: note: this is the location of the previous definition
    4 | #define ll double
      |
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 12 ms 1884 KB Output is correct
13 Correct 12 ms 2396 KB Output is correct
14 Correct 16 ms 3164 KB Output is correct
15 Correct 184 ms 17188 KB Output is correct
16 Correct 213 ms 18260 KB Output is correct
17 Correct 213 ms 17168 KB Output is correct
18 Correct 184 ms 17240 KB Output is correct
19 Correct 604 ms 35232 KB Output is correct
20 Correct 417 ms 27532 KB Output is correct
21 Correct 642 ms 37456 KB Output is correct
22 Correct 751 ms 37492 KB Output is correct