| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1339022 | vjudge1 | Sails (IOI07_sails) | C++20 | 1096 ms | 3124 KiB |
#include <bits/stdc++.h>
using namespace std;
struct hk
{
int h;
int k;
};
bool boolm(hk a, hk b)
{
return a.h < b.h;
}
int main()
{
int n;
if (!(cin >> n))
{
return 0;
}
vector<hk> vec(n);
int maxh = 0;
for (int i = 0; i < n; i++)
{
cin >> vec[i].h;
cin >> vec[i].k;
if (vec[i].h > maxh)
{
maxh = vec[i].h;
}
}
sort(vec.begin(), vec.end(), boolm);
vector<int> veca(maxh + 1, 0);
for (int i = 0; i < n; i++)
{
vector<pair<int, int>> vecb;
for (int h = 1; h <= vec[i].h; h++)
{
vecb.push_back({veca[h], h});
}
sort(vecb.begin(), vecb.end());
for (int j = 0; j < vec[i].k; j++)
{
veca[vecb[j].second]++;
}
}
int tot = 0;
for (int i = 1; i <= maxh; i++)
{
int c = veca[i];
tot += (c * (c - 1 )) / 2;
}
cout << tot << endl;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
