제출 #1089245

#제출 시각아이디문제언어결과실행 시간메모리
1089245vjudge1Kpart (eJOI21_kpart)C++17
0 / 100
2009 ms856 KiB
#include <bits/stdc++.h> //qwerty47924692 using namespace std; using ll = int; const ll N=1e5+29; ll n,t,a[N],mp[N],dp[N]; bool can(ll l,ll r){ multiset<ll>s; ll sum=0,cur=0; for(ll i=0;i<N;i++)dp[i]=0; for(ll i=l;i<=r;i++){ sum+=a[i]; dp[a[i]]=1; } if(sum&1)return 0; for(ll j=l;j<=r;j++){ for(ll i=a[j];i<=sum/2;i++){ dp[i]|=dp[i-a[j]]; } } return dp[sum/2]; } void solve(){ cin>>n; for(ll i=1;i<=n;i++){ cin>>a[i]; } vector<ll>v; for(ll k=2;k<=n;k++){ ll ch=1; for(ll i=1;i+k-1<=n;i++){ ll mid=((i+k-1)+i)>>1; ch&=can(i,i+k-1); }if(ch)v.push_back(k); } cout<<v.size(); for(ll i:v){ cout<<' '<<i; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll t; cin>>t; while(t--){ solve(); cout<<'\n'; } }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'bool can(ll, ll)':
Main.cpp:9:14: warning: unused variable 'cur' [-Wunused-variable]
    9 |     ll sum=0,cur=0;
      |              ^~~
Main.cpp: In function 'void solve()':
Main.cpp:33:16: warning: unused variable 'mid' [-Wunused-variable]
   33 |             ll mid=((i+k-1)+i)>>1;
      |                ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...