Submission #331240

#TimeUsernameProblemLanguageResultExecution timeMemory
331240vaavenStar triangles (IZhO11_triangle)C++14
100 / 100
452 ms14828 KiB
/* █████████████.....██████....██.........█....██████████....██.........██. ██.........██.......██......█.█........█....██......██.....██.......██.. ██.........██.......██......█..█.......█....██......██......██.....██... ██.........██.......██......█...█......█....██......██.......██...██.... ██.........██.......██......█....█.....█....██......██........██.██..... ██.........██.......██......█.....█....█....██......██.........███...... █████████████.......██......█.....█....█....██████████.........███...... ██..................██......█......█...█....██......██.........███...... ██..................██......█......█...█....██......██.........███...... ██..................██......█.......█..█....██......██.........███...... ██..................██......█.......█..█....██......██.........███...... ██..................██......█........█.█....██......██.........███...... ██..................██......█........█.█....██......██.........███...... ██................██████....█.........██....██......██.........███...... ЗАПУСКАЕМ ░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░ ▄███▀░◐░░░▌░░░░░░░ ░░░░▌░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▐░░░░░▐░░░░░░░ ░░░░▌░░░░░▐▄▄░░░░░ ░░░░▌░░░░▄▀▒▒▀▀▀▀▄ ░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄ ░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄ ░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄ ░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄ ░░░░░░░░░░░▌▌░▌▌░░░░░ ░░░░░░░░░░░▌▌░▌▌░░░░░ ░░░░░░░░░▄▄▌▌▄▌▌░░░░░ */ #include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <tuple> #include <math.h> #include <set> #include <stack> #include <bitset> #include <map> #include <queue> #include <random> //#define DEBUG #define pqueue priority_queue #define pb(x) push_back(x) #define all(x) x.begin(), x.end() #define int long long #define mk(a, b) make_pair(a, b) //#define x first; //#define y second; using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef vector<int> vi; typedef vector<vector<int> > vvi; typedef vector<ull> vull; typedef vector<ll> vll; typedef tuple<int, int, int> tiii; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef vector<bool> vb; typedef vector<string> vs; typedef vector< vector<int> > vvi; typedef vector<char> vc; const int INF = 1e9; const ll INFLL = 1e12; const int MOD = 1000000007; const ld eps = 1e-6; const int MOD2 = (1<<30)+1; const int dosz = 5e5; void fast_io(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef DEBUG // freopen("a.in", "r", stdin); #else // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); #endif } map<int, int> mp1; map<int, int> mp2; void solve(){ int n; cin >> n; vpii kek(n); for(int i=0; i<n; i++){ cin >> kek[i].first >> kek[i].second; mp1[kek[i].first]++; mp2[kek[i].second]++; } int ans = 0; for(pii i:kek){ ans += (mp1[i.first]-1)*(mp2[i.second]-1); } cout << ans; } signed main() { fast_io(); int q = 1; // cin >> q; while(q--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...