# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
703060 |
2023-02-25T20:45:38 Z |
LucaLucaM |
Sails (IOI07_sails) |
C++17 |
|
1000 ms |
4456 KB |
#include <bits/stdc++.h>
using namespace std;
/**
luam fiecare sail in ordine crescatoare dupa inaltime:
luam cele mai putin frecvente k inaltimi
adunam la raspuns
**/
const int NMAX = 1e5;
struct sail
{
int x, y;
bool operator < (const sail aux) const
{
if (x == aux.x)
return y < aux.y;
return x < aux.x;
}
};
sail a[NMAX + 5];
int f[NMAX + 5];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
for (int i=1; i<=n; i++)
cin >> a[i].x >> a[i].y;
long long ans = 0;
for (int i=1; i<=n; i++)
{
vector<pair<int, int>>v;
for (int j=1; j<=a[i].x; j++)
v.push_back({f[j], j});
sort(v.begin(), v.end());
for (int j=0; j<a[i].y; j++)
ans += v[j].first, f[v[j].second]++;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
318 ms |
420 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
1344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1065 ms |
1604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
2496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
4132 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
4348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1069 ms |
4456 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |