답안 #257125

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
257125 2020-08-03T15:51:02 Z islingr Sticks (POI11_pat) C++17
21 / 100
672 ms 4472 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)
#define ub(x...) upper_bound(x)

const int K = 1 << 6;
vector<int> s[K];

template<class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

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 || s[i].empty()) continue;
				auto it = ub(all(s[i]), a);
				if (it == begin(s[i])) continue;
				assert(*prev(it) <= a);
				if (ckmax(b, *prev(it))) cb = i;
			}
			if (b < 0) continue;
			rep(i, 0, k) {
				if (i == ca || i == cb || s[i].empty()) continue;
				auto it = ub(all(s[i]), b);
				if (it == begin(s[i])) continue;
				assert(*prev(it) <= b);
				if (ckmax(c, *prev(it))) cc = i;
			}
			if (c < 0) continue;
			++ca; ++cb; ++cc;
			if (b + c > a) {
				cout << ca << ' ' << a << ' ' << cb << ' ' << b <<  ' ' << cc << ' ' << c << '\n';
				return 0;
			}
		}
	}
	cout << "NIE\n";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Expected EOF
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB Expected EOF
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB Expected EOF
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Expected EOF
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 384 KB Expected EOF
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 560 KB Expected EOF
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 343 ms 2228 KB Output is correct
2 Correct 198 ms 1528 KB Output is correct
3 Incorrect 136 ms 1272 KB Expected EOF
# 결과 실행 시간 메모리 Grader output
1 Correct 337 ms 2296 KB Output is correct
2 Correct 219 ms 1656 KB Output is correct
3 Incorrect 217 ms 1656 KB Expected EOF
# 결과 실행 시간 메모리 Grader output
1 Correct 672 ms 4348 KB Output is correct
2 Correct 252 ms 1916 KB Output is correct
3 Incorrect 260 ms 1980 KB Expected EOF
# 결과 실행 시간 메모리 Grader output
1 Correct 669 ms 4472 KB Output is correct
2 Correct 298 ms 2296 KB Output is correct
3 Incorrect 322 ms 2424 KB Expected EOF