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 <cstdlib>
using namespace std;
int flagged[100001],n,h,k,height,mini,s;
int main(void)
{
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>h>>k;height=max(h,height);
for (int q=1;q<=k;q++)
{
mini=1;
for (int j=2;j<=h;j++)
{
if (flagged[j]<flagged[mini])
{
mini=j;
}
}
flagged[mini]++;
}
}
for (int i=1;i<=height;i++) s+=(flagged[i]-1)*flagged[i]/2;
cout<<s;
}
# | 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... |