QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#320227#8217. King's Dinnerucup-team2303#WA 1ms3836kbC++112.2kb2024-02-03 14:42:352024-02-03 14:42:37

Judging History

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

  • [2024-02-03 14:42:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3836kb
  • [2024-02-03 14:42:35]
  • 提交

answer

/*
60 + 0 + 100 + 64 = 224.
*/

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define L(i, j, k) for (int i = (j); i <= (k); i++)
#define R(i, j, k) for (int i = (j); i >= (k); i--)
#define pb push_back
#define pii pair<int, int>
inline int read()
{
	int sum = 0, nega = 1;
	char ch = getchar();
	while (ch > '9'||ch < '0')
	{
	    if (ch == '-') nega = -1;
		ch = getchar();
	}
	while (ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
	return sum * nega;
}
const int N = 109, mod = 998244353;
inline void add(int &x, int y) {x = (x + y) % mod;}
inline void del(int &x, int y) {x = (x - y + mod) % mod;}
int dp[N][N], T, n, p[N][N], ans[N][N]; 
inline int get(int x, int y) 
{
	if(x < -1 || y < -1) return -1e9;
	if(x == -1 || y == -1) return 0; 
	return dp[x][y]; 
}
inline void init(int nn)
{
	L(i, 1, nn) 
		L(j, 1, nn) 
		{
			if(dp[i][j] < get(i - 2, j) + (j + 1) / 3) dp[i][j] = get(i - 2, j) + (j + 1) / 3, p[i][j] = 1; 
			if(dp[i][j] < get(i - 3, j) + (j + 1) / 2) dp[i][j] = get(i - 3, j) + (j + 1) / 2, p[i][j] = 2;  
			if(dp[i][j] < get(i, j - 2) + (i + 1) / 3) dp[i][j] = get(i, j - 2) + (i + 1) / 3, p[i][j] = 3; 
			if(dp[i][j] < get(i, j - 3) + (i + 1) / 2) dp[i][j] = get(i, j - 3) + (i + 1) / 2, p[i][j] = 4; 
		}
	return ;
}
inline void work(int x, int y) 
{
	if(x <= 0 || y <= 0) return ;
	if(p[x][y] == 1) 
	{
		for (int i = 1; i < y; i += 3) ans[x][i] = ans[x][i + 1] = 1; 
		work(x - 2, y); return ; 
	}
	if(p[x][y] == 2) 
	{
		for (int i = 1; i <= y; i += 2) ans[x][i] = ans[x - 1][i] = 1;
		work(x - 3, y); return ;
	} 
	if(p[x][y] == 3) 
	{
		for (int i = 1; i < x; i += 3) ans[i][y] = ans[i + 1][y] = 1; 
		work(x, y - 2); return ;
	}
	if(p[x][y] == 4) 
	{
		for (int i = 1; i <= x; i += 2) ans[i][y] = ans[i][y - 1] = i; 
		work(x, y - 3); return ; 
	}
	return ;
}
inline void solve() 
{
	n = read();
	L(i, 1, n) 
		L(j, 1, n) ans[i][j] = 0;  
	work(n, n);
	L(i, 1, n) 
	{
		L(j, 1, n) 
		{
			if(!ans[i][j]) putchar('.');
			else putchar('#'); 
		}
		puts("");
	} 
}
signed main()
{
	T = read();
	init(100); 
	L(i, 1, T) solve();
	return 0;
}

 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3836kb

input:

3
1
2
3

output:

.
..
##
##.
...
##.

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3700kb

input:

50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

output:

.
..
##
##.
...
##.
#.#.
#.#.
....
##..
##.##
.....
##.##
.....
##.##
#.#.#.
#.#.#.
......
##.##.
......
##.##.
#.#.#.#
#.#.#.#
.......
#.#.#.#
#.#.#.#
.......
##.##..
#.#.#.#.
#.#.#.#.
........
##.##.##
........
##.##.##
........
##.##.##
#.#.#.#.#
#.#.#.#.#
.........
#.#.#.#.#
#.#.#.#.#
.........
...

result:

wrong answer jury has the better answer: jans = 4, pans = 3 (test case 4)