# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
313919 | hoaphat1 | Sticks (POI11_pat) | C++17 | 202 ms | 4260 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(2,make_pair(0,0));
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) {
if (a[j][id[j]] >= b[0].first) {
b[1] = b[0];
b[0] = make_pair(a[j][id[j]],j);
}
else if (a[j][id[j]] > b[1].first) {
b[1] = make_pair(a[j][id[j]],j);
}
}
}
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... |