QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#94510#5832. Make it Smootheyiigjkn0 61ms3920kbC++141.0kb2023-04-06 15:01:072023-04-06 15:01:09

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-06 15:01:09]
  • 评测
  • 测评结果:0
  • 用时:61ms
  • 内存:3920kb
  • [2023-04-06 15:01:07]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
constexpr int V=255,INF=1e9;
int a[110],f[110][310],g[310][10];
inline void chkmin(int &x,const int &y){x=min(x,y);}
int main()
{
	int T,D,I,M,n;
	cin>>T;
	for(int _=1;_<=T;_++)
	{
		scanf("%d%d%d%d",&D,&I,&M,&n);
		for(int i=1;i<=n;i++) scanf("%d",&a[i]);
		memset(f[1]+1,0,sizeof(int)*V);
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=V;j++) f[i][j]=min(f[i][j]+abs(a[i]-j),f[i-1][j]+D);
			if(i>=n) break;
			for(int j=M+1;j<=V;j++) chkmin(f[i][j],f[i][j-M]+I);
			for(int j=V-M;j;j--) chkmin(f[i][j],f[i][j+M]+I);
			for(int j=1;j<=V;j++) fill(g[j],g[j]+__lg(V-j+1)+1,INF);
			for(int j=1;j<=V;j++)
			{
				int le=max(j-M,1),ri=min(j+M,V),k=__lg(ri-le+1);
				chkmin(g[le][k],f[i][j]);
				chkmin(g[ri-(1<<k)+1][k],f[i][j]);
			}
			for(int j=1;j<=V;j++)
				for(int k=__lg(V-j+1);k;k--)
					chkmin(g[j][k-1],g[j][k]),chkmin(g[j+(1<<k-1)][k-1],g[j][k]);
			for(int j=1;j<=V;j++) f[i+1][j]=g[j][0];
		}
		printf("Case #%d: %d\n",_,*min_element(f[n]+1,f[n]+V+1));
	}
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3544kb

input:

100
6 6 2 3
1 7 5
100 1 5 3
1 50 7
0 1 255 3
133 252 183
1 0 1 3
52 227 19
1 0 0 3
1 3 2
1 0 0 3
13 12 13
255 0 0 2
100 200
255 0 0 3
111 220 125
255 0 0 3
0 169 255
255 255 255 3
255 0 255
2 2 254 3
255 0 255
255 255 0 1
13
239 68 38 2
5 102
116 48 24 3
58 34 64
67 92 118 2
199 197
43 19 11 3
22 5 ...

output:

Case #1: 4
Case #2: 17
Case #3: 0
Case #4: 0
Case #5: 2
Case #6: 1
Case #7: 100
Case #8: 109
Case #9: 255
Case #10: 1
Case #11: 1
Case #12: 0
Case #13: 59
Case #14: 6
Case #15: 0
Case #16: 7
Case #17: 51
Case #18: 46
Case #19: 0
Case #20: 158
Case #21: 105
Case #22: 0
Case #23: 60
Case #24: 55
Case ...

result:

wrong answer 10th lines differ - expected: 'Case #10: 0', found: 'Case #10: 1'

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 61ms
memory: 3920kb

input:

100
0 1 255 100
49 143 17 173 79 19 33 114 219 201 224 37 187 158 227 109 190 15 174 108 76 131 3 13 13 11 27 84 74 227 183 188 196 70 173 141 32 151 53 78 83 54 135 86 43 46 242 238 34 152 161 139 61 178 180 42 72 194 222 252 33 70 103 41 51 225 133 36 44 181 52 178 85 240 255 46 184 176 221 227 19...

output:

Case #1: 0
Case #2: 0
Case #3: 0
Case #4: 98
Case #5: 127
Case #6: 118
Case #7: 82
Case #8: 36
Case #9: 67
Case #10: 557
Case #11: 373
Case #12: 510
Case #13: 664
Case #14: 453
Case #15: 571
Case #16: 24
Case #17: 24
Case #18: 4056
Case #19: 6096
Case #20: 49
Case #21: 48
Case #22: 49
Case #23: 48
C...

result:

wrong answer 7th lines differ - expected: 'Case #7: 81', found: 'Case #7: 82'