Submission #651270

# Submission time Handle Problem Language Result Execution time Memory
651270 2022-10-18T05:04:05 Z dilaylay_dilaylaylay Star triangles (IZhO11_triangle) C++17
100 / 100
397 ms 15608 KB
#include <iostream>
#include <bits/stdc++.h>    
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
 
using namespace std;
 
#define int long long
#define ll long long
#define vi vector<long long>
#define pb push_back
#define sz(s) (int)s.size()
#define all(v) v.begin(), v.end()
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define pp pair<int,int>
#define FF first
#define SS second
#define endl "\n"
 
const int N = 1e6 + 2, N3 = 1e3 + 6, inf = 1e9 + 7, LOG = 20;
map<char, int> md{{'N', 0}, {'E', 1}, {'S', 2}, {'W', 3}};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
string stepDir = "RDLU";
 
int n, x[N], y[N], ans	;
map<int, int> cnt, cnt2;
 
main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);	
	
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		cnt[x[i]]++;
		cnt2[y[i]]++;
	}
	
	for (int i = 1; i <= n; i++) {
		ans += (cnt[x[i]] - 1) * (cnt2[y[i]] - 1);
	}
	
	cout << ans;
		
	return 0;
}

Compilation message

triangle.cpp:13: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
   13 | #pragma comment(linker, "/stack:200000000")
      | 
triangle.cpp:40:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   40 | main () {
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 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 8 ms 1240 KB Output is correct
14 Correct 17 ms 1792 KB Output is correct
15 Correct 175 ms 7884 KB Output is correct
16 Correct 143 ms 8332 KB Output is correct
17 Correct 125 ms 7860 KB Output is correct
18 Correct 124 ms 7904 KB Output is correct
19 Correct 397 ms 14740 KB Output is correct
20 Correct 292 ms 11856 KB Output is correct
21 Correct 376 ms 15608 KB Output is correct
22 Correct 353 ms 15576 KB Output is correct