# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464417 | prvocislo | Sticks (POI11_pat) | C++17 | 236 ms | 18044 KiB |
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 <vector>
#include <set>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int k;
cin >> k;
vector<pair<int, int> > v;
for (int i = 1; i <= k; i++)
{
int n; cin >> n;
for (int j = 0, len; j < n; j++)
{
cin >> len;
v.push_back({ len, i });
}
}
sort(v.begin(), v.end());
vector<int> maxi(k+1, -1e9);
for (int i = 0; i < v.size(); i++)
{
int i1 = 0, i2 = 0;
for (int j = 1; j <= k; j++) if (j != v[i].second)
{
if (maxi[j] > maxi[i1]) i2 = i1, i1 = j;
else if (maxi[j] > maxi[i2]) i2 = j;
}
if (maxi[i1] + maxi[i2] > v[i].first)
{
cout << i1 << " " << maxi[i1] << " " << i2 << " " << maxi[i2] << " " << v[i].second << " " << v[i].first << "\n";
return 0;
}
maxi[v[i].second] = v[i].first;
}
cout << "NIE\n";
return 0;
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |