# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1107406 | vjudge1 | Kpart (eJOI21_kpart) | C++17 | 2058 ms | 1608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define iosBASE ios::sync_with_stdio(false);cin.tie(0);cout.tie (0);
void Freopen () {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
const ll INF = (ll)1e18 + 7;
const ll mod = (ll)1e9 + 7;
const ll N = 1e5 + 5;
using namespace std;
int n, a[N], cnt[N];
void ma1n () {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
cnt[i] = 0;
}
set <int> s;
vector <int> ans;
for (int i = 1; i <= n; i++) {
s.clear ();
s.insert (0);
int sum = 0;
for (int j = i; j <= n; j++) {
for (auto to : s) {
s.insert (-(-to + a[j]));
}
sum += a[j];
if (sum % 2 == 0 && s.find (-sum / 2) != s.end ()) {
cnt[j - i + 1]++;
if (cnt[j - i + 1] == n - j + i) {
ans.push_back (j - i + 1);
}
}
}
}
sort (ans.begin (), ans.end ());
cout << ans.size () << " ";
for (auto to : ans) {
cout << to << " ";
}
cout << "\n";
}
int main () {
iosBASE;
int t = 1;
cin >> t;
for (int i = 1; i <= t; i++) {
ma1n ();
}
return 0;
}
컴파일 시 표준 에러 (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... |