QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#320441 | #8217. King's Dinner | ucup-team2303# | WA | 1ms | 4328kb | C++14 | 2.4kb | 2024-02-03 16:52:29 | 2024-02-03 16:52:30 |
Judging History
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 = 209, 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;
if(i==4&&j==4)
{
dp[i][j]=4;
p[i][j]=5;
}
}
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] = 1;
work(x, y - 3); return ;
}
if(p[x][y]==5)
{
ans[1][1]=ans[1][2]=1;
ans[1][4]=ans[2][4]=1;
ans[3][1]=ans[4][1]=1;
ans[4][3]=ans[4][4]=1;
return;
}
return ;
}
inline void solve(int tt)
{
n = read();
if(n <= 0) return ;
L(i, 0, n + 1)
L(j, 0, n + 1) 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(200);
L(i, 1, T) solve(i);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4328kb
input:
3 1 2 3
output:
. .. ## ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 4304kb
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 = 8, pans = 7 (test case 6)