QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#291400#7943. LIS on GriddieselhuangWA 0ms3888kbC++14845b2023-12-26 15:01:352023-12-26 15:01:35

Judging History

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

  • [2023-12-26 15:01:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3888kb
  • [2023-12-26 15:01:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n, m, nm, a[200010], c[200010];
bool b[200010];
int main()
{
	int t, i, j, p, x, tmp;
	scanf("%d", &t);
	while(t--){
		scanf("%d%d", &n, &m); nm = n * m;
		for(i = 1; i <= m; i++) scanf("%d", &a[i]);
		for(x = 1; x <= n; x++){
			for(i = 1, j = 0; i <= m; i++) j += max(a[i] - x, 0);
			if(j <= x * (n - x)) break;
		}
		printf("%d\n", x);
		for(i = 1; i <= nm; i++) b[i] = false;
		for(i = 1; i <= m; i++) c[i] = 0;
		for(i = 1; i <= x; i++){
			for(j = 1, p = n - x + i; j <= m; j++){
				tmp = c[j]; c[j] = p;
				if(a[j] > x - i) b[(p - 1) * m + j] = true; a[j]--;
				while(p > tmp + 1 && a[j] > x - i) b[(--p - 1) * m + j] = true, a[j]--;
			}
		}
		for(i = 1; i <= nm; i++){
			putchar(b[i] ? '#' : '.');
			if(i % m == 0) putchar('\n');
		}
	}
	return 0;
}

详细

Test #1:

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

input:

4
2 4
1 1 1 1
3 3
3 3 3
4 4
4 3 2 1
4 5
2 3 4 3 2

output:

1
....
####
3
###
###
###
2
###.
#...
###.
##..
2
..###
.####
####.
###..

result:

wrong answer Wrong number of colored cells (test case 3)