# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1031336 |
2024-07-22T17:52:52 Z |
racsosabe |
Sticks (POI11_pat) |
C++14 |
|
147 ms |
17844 KB |
#include <bits/stdc++.h>
using namespace std;
int k;
vector<pair<int, int>> v;
int main() {
cin.tie(0) -> sync_with_stdio(false);
cin >> k;
for(int i = 1; i <= k; i++) {
int q;
cin >> q;
for(int j = 0; j < q; j++) {
int x;
cin >> x;
v.emplace_back(x, i);
}
}
sort(v.begin(), v.end());
vector<int> maxi(k + 1, -1);
int max1 = 1, max2 = 2, max3 = 3;
for(int i = 0; i < v.size(); i++) {
int a, b;
if(max1 == v[i].second) a = max2, b = max3;
else if(max2 == v[i].second) a = max1, b = max3;
else a = max1, b = max2;
if(v[i].first < maxi[a] + maxi[b]) {
cout << a << " " << maxi[a] << " " << b << " " << maxi[b] << " " << v[i].second << " " << v[i].first << endl;
return 0;
}
maxi[v[i].second] = v[i].first;
if(v[i].second != max1 and v[i].second != max2 and v[i].second != max3) {
swap(max2, max3);
swap(max1, max2);
max1 = v[i].second;
}
else {
if(maxi[max3] > maxi[max2]) swap(max2, max3);
if(maxi[max2] > maxi[max1]) swap(max1, max2);
}
}
cout << "NIE" << endl;
return 0;
}
Compilation message
pat.cpp: In function 'int main()':
pat.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for(int i = 0; i < v.size(); i++) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Oczekiwano NIE |
2 |
Correct |
4 ms |
992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Oczekiwano NIE |
2 |
Correct |
5 ms |
1248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
856 KB |
Oczekiwano NIE |
2 |
Correct |
13 ms |
2268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
992 KB |
Oczekiwano NIE |
2 |
Correct |
20 ms |
3720 KB |
Output is correct |
3 |
Correct |
15 ms |
2364 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
2160 KB |
Oczekiwano NIE |
2 |
Correct |
36 ms |
6868 KB |
Output is correct |
3 |
Correct |
21 ms |
3800 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
9308 KB |
Output is correct |
2 |
Correct |
45 ms |
6884 KB |
Output is correct |
3 |
Correct |
34 ms |
4308 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
9272 KB |
Output is correct |
2 |
Correct |
48 ms |
6924 KB |
Output is correct |
3 |
Correct |
42 ms |
6868 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
146 ms |
17844 KB |
Output is correct |
2 |
Correct |
61 ms |
7336 KB |
Output is correct |
3 |
Correct |
76 ms |
7636 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
147 ms |
17844 KB |
Output is correct |
2 |
Correct |
69 ms |
8392 KB |
Output is correct |
3 |
Correct |
73 ms |
13008 KB |
Oczekiwano NIE |