# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
974886 | vjudge1 | 별들과 삼각형 (IZhO11_triangle) | C++17 | 0 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
long long count(const vector<pair<int, int>> &points)
{
long long count = 0;
int n = points.size();
map<int, int> rowCount;
for (const auto &point : points)
{
rowCount[point.second]++;
}
for (int i = 0; i < n; ++i)
{
int x1 = points[i].first;
int y1 = points[i].second;
map<int, int> rightCount;
for (int j = i + 1; j < n; ++j)
{
int x2 = points[j].first;
int y2 = points[j].second;
if (y2 == y1)
{
rightCount[x2]++;
}
}
for (auto &row : rowCount)
{
int y2 = row.first;
int countOnRow = row.second;
if (y2 <= y1)
{
count += (countOnRow - 1) * rightCount[y2];
}
else
{
count += countOnRow * rightCount[y2];
}
}
}
return count;
}
void solve()
{
cin >> n;
vector<pair<int, int>> point(n);
for (int i = 0; i < n; i++)
{
cin >> point[i].first >> point[i].second;
}
cout << count(point);
}
int main()
{
int t = 1;
while (t--)
{
solve();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |