QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#350038 | #8217. King's Dinner | ucup-team1525# | WA | 1ms | 3748kb | C++17 | 1.3kb | 2024-03-10 13:02:14 | 2024-03-10 13:02:14 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int t,n;
char s[1005][1005];
int main()
{
scanf("%d",&t);
while (t--)
{
scanf("%d",&n);
int ans=0,l=0;
for (int i=0;i*3-1<=n;++i)
{
int sum1=(n+1)/2*i;
int down=n-i*3+1;
int downp=down/2;
int sum2=(n+1)/3*downp;
if (sum1+sum2>=ans)
{
ans=sum1+sum2;
l=i;
}
}
int p=1;
for (int i=1;i<=n;++i)
for (int j=1;j<=n;++j)
s[i][j]='.';
for (int i=1;i<=l;++i)
{
for (int j=1;j<=n;++j)
if (j%2==1)
s[p][j]='#';
++p;
for (int j=1;j<=n;++j)
if (j%2==1)
s[p][j]='#';
++p;
++p;
}
int r=(n-l*3+1)/2;
for (int i=1;i<=r;++i)
{
for (int j=1;j<=n;++j)
if (j%3!=0&&(j!=n||n%3==2))
s[p][j]='#';
++p;
++p;
}
for (int i=1;i<=n;++i)
{
for (int j=1;j<=n;++j)
putchar(s[i][j]);
putchar('\n');
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3748kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3748kb
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)