# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
839644 | Dzadzo | Kpart (eJOI21_kpart) | C++11 | 2015 ms | 2928 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#include <bits/functexcept.h>
#include <iosfwd>
#include <bits/cxxabi_forced.h>
#include <bits/functional_hash.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2", "popcnt")
#pragma push_macro("__SIZEOF_LONG__")
#pragma push_macro("__cplusplus")
#pragma pop_macro("__cplusplus")
#pragma pop_macro("__SIZEOF_LONG__")
#undef unsigned
#undef __builtin_popcountl
#undef __builtin_ctzl
#define __SIZEOF_LONG__ __SIZEOF_LONG_LONG__
#define unsigned unsigned long
#define __cplusplus 201102L
#define pb push_back
#define S second
#define F first
#define pii pair<int,int>
#define vi vector <int>
#define vvi vector <vi>
#define vvvi vector <vvi>
#define INF LLONG_MAX
#define MOD 1000000009
#define MAXN 100000
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
signed main() {
int t;
scanf("%d",&t);
while (t--){
int n;
scanf("%d",&n);
int a[n+1];
int p[n+1];
p[0]=0;
for (int i=1;i<=n;i++){scanf("%d",&a[i]);p[i]=p[i-1]+a[i];}
bitset<50001>b[n];
for (int i=1;i<n;i++)b[i][0]=1;
for (int i=1;i<n;i++){
b[i] |= (b[i]<<a[i]);
}
vi ans;
for (int k=2;k<=n;k++){
bool check=true;
for (int i=k;i<=n;i++){
b[i-k+1] |= (b[i-k+1]<<a[i]);
if ((p[i]-p[i-k])%2!=0){check=false;}else
if (!b[i-k+1][(p[i]-p[i-k])/2])check=false;
}
if (check)ans.pb(k);
}
printf("%lu",ans.size());
for (int x:ans)printf(" %d",x);
printf("\n");
}
}
컴파일 시 표준 에러 (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... |