답안 #1096734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1096734 2024-10-05T04:48:31 Z stdfloat Bigger segments (IZhO19_segments) C++17
0 / 100
8 ms 352 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);

	int n;
	cin >> n;

	vector<int> a(n);
	for (auto &i : a)
		cin >> i;

	int mx = 1;
	for (int mk = 0; mk < 1 << n; mk++) {
		int cnt = 0;
		ll pre_sm = -1, sm = 0;
		for (int i = 0; i < n; i++) {
			if (!i || (((mk >> i) & 1) != ((mk >> (i - 1)) & 1))) {
				if (pre_sm > sm) {
					cnt = 0; break;
				}

				cnt++;
				pre_sm = sm; sm = 0;
			}

			sm += a[i];
		}

		mx = max(mx, cnt);
	}

	cout << mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 8 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 8 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 8 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 8 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 8 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -