Submission #257142

# Submission time Handle Problem Language Result Execution time Memory
257142 2020-08-03T16:14:17 Z islingr Sticks (POI11_pat) C++17
100 / 100
680 ms 5356 KB
#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

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
1 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Oczekiwano NIE
2 Correct 18 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Oczekiwano NIE
2 Correct 25 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Oczekiwano NIE
2 Correct 59 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 640 KB Oczekiwano NIE
2 Correct 91 ms 1400 KB Output is correct
3 Correct 79 ms 1332 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 59 ms 1016 KB Oczekiwano NIE
2 Correct 163 ms 1784 KB Output is correct
3 Correct 124 ms 1400 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 335 ms 3276 KB Output is correct
2 Correct 214 ms 2620 KB Output is correct
3 Correct 176 ms 1784 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 349 ms 3404 KB Output is correct
2 Correct 246 ms 2808 KB Output is correct
3 Correct 260 ms 2252 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 680 ms 5240 KB Output is correct
2 Correct 319 ms 2936 KB Output is correct
3 Correct 354 ms 3080 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 663 ms 5356 KB Output is correct
2 Correct 295 ms 3192 KB Output is correct
3 Correct 452 ms 3560 KB Oczekiwano NIE