| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1338997 | po_rag526 | Sails (IOI07_sails) | C++20 | 1 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
struct str
{
int h;
int k;
};
bool boolmat(str a, str b)
{
return a.h < b.h;
}
int main()
{
int n;
vector<str> mast(n);
int maxh = 0;
for (int i = 0; i < n; i++)
{
cin >> mast[i].h;
cin >> mast[i].k;
if (mast[i].h > maxh)
{
maxh = mast[i].h;
}
}
sort(mast.begin(), mast.end(), boolmat);
vector<int> cnt(maxh + 1, 0);
for (int i = 0; i < n; i++)
{
vector<pair<int, int>> niv;
for (int h = 1; h <= mast[i].h; h++)
{
niv.push_back({cnt[h], h});
}
sort(niv.begin(), niv.end());
for (int j = 0; j < mast[i].k; j++)
{
cnt[niv[j].second]++;
}
}
long long tot = 0;
for (int i = 1; i <= maxh; i++)
{
long long c = cnt[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... | ||||
