QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#637354#7304. Coins 2juan_123WA 0ms4068kbC++141.4kb2024-10-13 12:20:002024-10-13 12:20:00

Judging History

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

  • [2024-10-13 12:20:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4068kb
  • [2024-10-13 12:20:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
bitset<510005>dp;
int n;
int a[105];
int b[1005];
int l[10],r[10];
signed main(){
	
	int mx =0 ;
	cin >> n;
	for(int i = 1;i<=n;i++)cin >> a[i];
	for(int i = 1;i<=n;i++)mx=max(mx,a[i]);
	if(mx<=100){
		dp[0]=1;
		for(int i = 1;i<=n;i++){
			vector<int>p;int aa = a[i];
			int pro = 1;
			while(a[i]>=pro){
			//	cout << " " << a[i] << " " << pro << endl;
				dp|=dp<<(i*pro);
				a[i]-=pro;pro*=2;
			}
			if(a[i])dp|=dp<<(a[i]*i);
			a[i]=aa;
		}
		cout << dp.count() << endl;
		return 0;
	}
	if(n == 3){
		int sum =0 ;
		for(int i = 1;i<=n;i++)sum+=i*a[i];
		if(a[1]>=2 or (a[1] and a[2])){cout << sum+1 << endl;return 0;}
	//	cout << 11  <<" " <<a[1]<< endl;
		if(a[1] == 1){cout << (a[3]+1)*2 << endl;return 0;}
		if(a[2] == 1){cout << (a[3]+1)*2 << endl;return 0;}
		for(int i =0;i<=6;i++)l[i] = 114514;
		for(int i =0;i<=min(a[2],3ll);i++){
			for(int j =0;j<=min(a[3],2ll);j++){
				int v= 2*i+3*j;
				l[v%6]=min(l[v%6],v);
				r[v%6]=max(r[v%6],v+(a[2]-i)/3*6+(a[3]-j)/2*6);
			}
		}
		int ans =0 ;
	//	for(int j=0;j<6;j++)cout << l[j] <<" " << r[j] << endl;
		for(int j =0;j<6;j++)if(l[j]!=114514)ans = ans+(r[j]-l[j])/6+1;
		cout << ans << endl;
		//只有 2 3
	}
	return 0;
}/*
3
1 0 114514
3
1 1 4325
3 
2 90 42837
3
1 3748 0
3
0 1 4837
3 
0 438 8543
3
0 47 45
3
0 4654 3457
3
0 2 5487
*/

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4068kb

input:

3
0 1 2
3
0 2 3

output:

6

result:

wrong answer Answer contains longer sequence [length = 2], but output contains 1 elements