제출 #612527

#제출 시각아이디문제언어결과실행 시간메모리
612527karelispKpart (eJOI21_kpart)C++14
0 / 100
2081 ms340 KiB
#include <bits/stdc++.h> using namespace std; int T, N, a[1005], ps[1005]; int main(){ scanf("%d", &T); while(T--){ scanf("%d", &N); for(int i=1; i<=N; i++){ scanf("%d", &a[i]); ps[i] = ps[i-1] + a[i]; } vector<int> ans; for(int K=2; K<=N; K++){ bitset<100005> bs; bool is_Kary = true; for(int right=1; right<=N && is_Kary; right++){ bs[0] = true; bs |= bs<<a[right]; if(right<K) continue; int cur_sum = ps[right] - ps[right-K]; if(cur_sum%2 || bs[cur_sum/2]==0){ is_Kary = false; } bs = bs>>a[right-K+1]; } if(is_Kary) ans.push_back(K); } printf("%ld ", ans.size()); for(auto K : ans) printf("%d ", K); printf("\n"); } return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%d", &T);
      |  ~~~~~^~~~~~~~~~
Main.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%d", &N);
      |   ~~~~~^~~~~~~~~~
Main.cpp:12:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |    scanf("%d", &a[i]);
      |    ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...