# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
494370 |
2021-12-15T10:49:16 Z |
stefantaga |
Sails (IOI07_sails) |
C++14 |
|
1000 ms |
1512 KB |
#include <bits/stdc++.h>
using namespace std;
bool compare (pair <int,int> a,pair <int,int > b)
{
return a.first<b.first||(a.first==b.first&&a.second>b.second);
}
int n,i,h,k,j,maxi;
long long sum;
pair <int,int> sal[100005];
int v[100005];
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(0);
#ifdef HOME
ifstream cin("date.in");
ofstream cout("date.out");
#endif // HOME
cin>>n;
for (i=1;i<=n;i++)
{
cin>>h>>k;
maxi=max(maxi,h);
for (j=1;j<=h;j++)
{
sal[j]={v[j],j};
}
sort (sal+1,sal+h+1,compare);
for (j=1;j<=k;j++)
{
v[sal[j].second]++;
}
}
for (j=1;j<=maxi;j++)
{
sum=sum+(v[j]*(v[j]-1)/2);
}
cout<<sum;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
507 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
640 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
700 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
944 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
1476 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
1504 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
1512 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |