QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#320464 | #8217. King's Dinner | ucup-team2303# | AC ✓ | 2ms | 4424kb | C++14 | 2.7kb | 2024-02-03 17:09:09 | 2024-02-03 17:09:10 |
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;
}
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;
if(dp[n/2][n/2-1]*4>dp[n][n])
{
work(n/2,n/2-1);
for(int i=1;i<=n/2;i++)
{
for(int j=1;j<=n/2-1;j++)
{
ans[j+n/2+1][i]=ans[i][j];
ans[j][n/2+i]=ans[i][j];
ans[n/2+i][n/2+1+j]=ans[i][j];
}
}
L(i, 1, n)
{
L(j, 1, n)
{
if(!ans[i][j]) putchar('.');
else putchar('#');
}
puts("");
}
return;
}
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;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4284kb
input:
3 1 2 3
output:
. .. ## ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 4424kb
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:
ok all tests correct (50 test cases)
Test #3:
score: 0
Accepted
time: 2ms
memory: 4372kb
input:
39 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ................................................... #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...........................................
result:
ok all tests correct (39 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 4360kb
input:
11 90 91 92 93 94 95 96 97 98 99 100
output:
##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# .............................................#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.............................................. ..............................
result:
ok all tests correct (11 test cases)
Test #5:
score: 0
Accepted
time: 1ms
memory: 4388kb
input:
1 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#................................................... ..................................................##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##....
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed