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;
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
const int K = 1 << 6;
vector<int> s[K];
signed main() {
int k; cin >> k;
rep(i, 0, k) {
int n; cin >> n;
s[i].resize(n);
for (auto &x : s[i]) cin >> x;
sort(all(s[i]));
}
rep(ca, 0, k) {
for (int a : s[ca]) {
int b = -1, cb, c = -1, cc;
rep(i, 0, k) {
if (i == ca) continue;
auto it = upper_bound(all(s[i]), a);
if (it-- == begin(s[i])) continue;
if (b <= *it) {
c = b; cc = cb;
b = *it; cb = i;
} else if (c < *it) c = *it, cc = i;
}
if (c < 0) continue;
if (b + c > a) return cout << ++ca << ' ' << a << ' ' << ++cb << ' ' << b << ' ' << ++cc << ' ' << c, 0;
}
}
cout << "NIE";
}
Compilation message (stderr)
pat.cpp: In function 'int main()':
pat.cpp:31:106: warning: 'cb' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (b + c > a) return cout << ++ca << ' ' << a << ' ' << ++cb << ' ' << b << ' ' << ++cc << ' ' << c, 0;
^
# | 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... |