# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
313916 | hoaphat1 | Sticks (POI11_pat) | C++17 | 207 ms | 13944 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<bits/stdc++.h>
using namespace std;
void fff(string s = "") {
if (s == "1") cin >> s;
if ((int)s.size() >= 4 && s.substr(s.size() - 4) == ".inp") {
freopen(s.c_str(),"r",stdin);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
fff("");
int n;
cin >> n;
vector<vector<int>> a(n);
for (int i = 0; i < n; i++) {
int foo;
cin >> foo;
a[i].resize(foo);
for (auto&x : a[i]) {
cin >> x;
}
sort(a[i].begin(),a[i].end());
}
for (int i = 0; i < n; i++) {
vector<int> id(n,-1);
for (auto&x : a[i]) {
vector<pair<int,int>> b;
for (int j = 0; j < n; j++) {
if (i == j) continue;
while (id[j] < (int)a[j].size() - 1 && a[j][id[j] + 1] <= x) id[j] += 1;
if (id[j] != -1) b.emplace_back(a[j][id[j]],j);
if ((int)b.size() > 2) {
sort(b.rbegin(),b.rend());
b.pop_back();
}
}
if ((int)b.size() == 2 && b[0].first + b[1].first > x) {
cout << i + 1 <<" " << x <<" " << b[0].second + 1 <<" " << b[0].first <<" " << b[1].second + 1 <<" " << b[1].first;
exit(0);
}
}
}
cout << "NIE";
}
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... |