QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#301577#5475. Make a LoopwxhtzdyCompile Error//C++20335b2024-01-10 03:35:412024-01-10 03:35:42

Judging History

你现在查看的是最新测评结果

  • [2024-01-10 03:35:42]
  • 评测
  • [2024-01-10 03:35:41]
  • 提交

answer

#include<iostream>

int n,x,i,j,f,dp[2][1000005];

int main(){
scanf("%d",&n);
	dp[0][0]=1;
	int s=0;
	for(i=1;i<=n;i++){
scanf("%d",&x);
		s+=x;
		for(j=s;j>=x;j--){
			for(f=0;f<2;f++){
				dp[f][j]=min(4,dp[f][j]+dp[f^1][j-x]);
			}
		}
	}
	if(n%2==0&&s%2==0&&dp[0][s/2]>=4) printf("Yes\n"); else printf("No\n");
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:14:42: error: ‘min’ was not declared in this scope; did you mean ‘std::min’?
   14 |                                 dp[f][j]=min(4,dp[f][j]+dp[f^1][j-x]);
      |                                          ^~~
      |                                          std::min
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: ‘std::min’ declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
answer.code:6:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 | scanf("%d",&n);
      | ~~~~~^~~~~~~~~
answer.code:10:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 | scanf("%d",&x);
      | ~~~~~^~~~~~~~~