# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
649569 | dilaylay_dilaylaylay | Star triangles (IZhO11_triangle) | C++17 | 2 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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
const int N = 1e5 + 2, N3 = 1e3 + 6, inf = 1e9;
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, a[1001], b[1001], ans;
main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
freopen("triangles.in", "r", stdin);
freopen("triangles.out", "w", stdout);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i] >> b[i];
}
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
for (int k = j + 1; k <= n; k++) {
if ((a[i] == a[j] && a[j] == a[k]) || (b[i] == b[j] && b[j] == b[k])) continue;
if (a[i] == a[j]) ans++;
else if (a[i] == a[k]) ans++;
else if (a[j] == a[k]) ans++;
else if (b[i] == b[j]) ans++;
else if (b[i] == b[k]) ans++;
else if (b[j] == b[k]) ans++;
}
}
}
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |