제출 #685233

#제출 시각아이디문제언어결과실행 시간메모리
685233tolbiBootfall (IZhO17_bootfall)C++17
28 / 100
128 ms8148 KiB
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
#define author tolbi
#include<bits/stdc++.h>
#define endl '\n'
#define int short
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define vint(x) vector<int> x
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define revarr(x) reverse(x.begin(), x.end())
#define tol(bi) (1LL<<((int)(bi)))
#define INF LONG_LONG_MAX
using namespace std;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
const int MOD = 1e9+7;
int32_t main(){
	int T=1;
	int tno=0;
	if (!T) cin>>T;
	while (T-(tno++)){
		deci(n);
		vint(arr(n));
		cinarr(arr);
		int somma = 0; for (int i = 0; i < n; i++) somma+=arr[i];
		vector<vector<vector<bitset<350>>>> dp(2,vector<vector<bitset<350>>>(somma+1,vector<bitset<350>>(2)));
		for (int i = 0; i < n; ++i)
		{
			dp[0][0][1][i]=true;
		}
		bitset<350> bos;
		for (int node = 1; node <= n; node++){
			for (int crr = 0; crr <= somma; crr++){
				for (int flag = 0; flag < 2; flag++){
					dp[1][crr][flag]&=bos;
					if (!flag){
						dp[1][crr][flag][node-1]=true;
						dp[1][crr][flag]&=dp[0][crr][1];
					}
					if (abs(crr-arr[node-1])<=somma) dp[1][crr][flag]|=dp[0][abs(crr-arr[node-1])][flag];
					if (abs(crr+arr[node-1])<=somma) dp[1][crr][flag]|=dp[0][abs(crr+arr[node-1])][flag];
				}
			}
			swap(dp[0],dp[1]);
		}
		if (dp[0][0][1].count()==0){
			cout<<0<<endl;
			continue;
		}
		vector<int> say;
		for (int i = 1; i < somma; i++){
			if (dp[0][i][0].count()==n){
				say.push_back(i);
			}
		}
		cout<<say.size()<<endl;
		coutarr(say);
	}
}

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

bootfall.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
bootfall.cpp:27:20: warning: overflow in conversion from 'double' to 'short int' changes value from '1.000000007e+9' to '32767' [-Woverflow]
   27 | const int MOD = 1e9+7;
      |                 ~~~^~
bootfall.cpp: In function 'int32_t main()':
bootfall.cpp:63:27: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'short int' [-Wsign-compare]
   63 |    if (dp[0][i][0].count()==n){
      |        ~~~~~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...