QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#463479 | #8217. King's Dinner | wdnmdwrnmmp | AC ✓ | 4ms | 3692kb | C++14 | 2.0kb | 2024-07-04 21:38:21 | 2024-07-04 21:38:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef vector<int> vi;
typedef pair<int,int> pi;
vector< vector<string> > sq(7), rec(7);
void init(){
sq[1]={
"."
};
sq[2]={
"##",
".."
};
sq[3]={
"##.",
"...",
"##."
};
sq[4]={
"##.#",
"...#",
"#...",
"#.##"
};
sq[5]={
"##.##",
".....",
"##.##",
".....",
"##.##"
};
sq[6]={
"##.#.#",
"...#.#",
"##....",
"....##",
"#.#...",
"#.#.##"
};
rec[1]={
"##.##."
};
rec[2]={
"#.#.#.",
"#.#.#."
};
rec[3]={
"##.##.",
"......",
"##.##."
};
rec[4]={
"##.##.",
"......",
"#.#.#.",
"#.#.#."
};
rec[5]={
"##.##.",
"......",
"##.##.",
"......",
"##.##."
};
rec[6]={
"#.#.#.",
"#.#.#.",
"......",
"##.##.",
"......",
"##.##."
};
}
void solve(){
int n; cin>>n;
vector<vector<bool>> ans(n, vector<bool>(n));
auto write0=[&](int x,int y){
rep(i,0,5){
rep(j,0,5){
ans[x+i][y+j]=(j%3<=1 && i%2==0);
}
}
};
auto write1=[&](int x,int y,int a,int op){
if(op==0){
rep(i,0,5){
rep(j,0,a-1){
ans[x+i][y+j]=(rec[a][j][i]=='#');
}
}
}
if(op==1){
rep(i,0,a-1){
rep(j,0,5){
ans[x+i][y+j]=(rec[a][i][j]=='#');
}
}
}
};
auto write2=[&](int x,int y,int a){
rep(i,0,a-1){
rep(j,0,a-1){
ans[x+i][y+j]=(sq[a][i][j]=='#');
}
}
};
int s=(n-1)/6;
rep(i,1,s){
rep(j,1,s){
write0((i-1)*6, (j-1)*6);
}
}
int r=(n-1)%6+1;
rep(i,1,s){
write1((i-1)*6, s*6, r, 0);
write1(s*6, (i-1)*6, r, 1);
}
write2(n-r, n-r, r);
rep(i,0,n-1){
rep(j,0,n-1){
cout<<(ans[i][j]? "#": ".");
}
cout<<'\n';
}
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
init();
int t; cin>>t;
while(t--){
solve();
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3604kb
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: 4ms
memory: 3548kb
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: 2ms
memory: 3692kb
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: 3652kb
input:
1 100
output:
##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.#.## ................................................................................................#... ##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##......
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed