QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#463471#8217. King's DinnerwdnmdwrnmmpWA 0ms3880kbC++141.9kb2024-07-04 21:23:332024-07-04 21:23:34

Judging History

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

  • [2024-07-04 21:23:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3880kb
  • [2024-07-04 21:23:33]
  • 提交

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]={
		"##.##.",
		"......",
		"##.##.",
		"......",
		"##.##."
	};
}
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 b){
		if(a==b){
			rep(i,0,a-1){
				rep(j,0,b-1){
					ans[x+i][y+j]=(sq[a][i][j]=='#');
				}
			}
		}
		else{
			if(a==6){
				rep(i,0,a-1){
					rep(j,0,b-1){
						ans[x+i][y+j]=(rec[b][j][i]=='#');
					}
				}
			}
			if(b==6){
				rep(i,0,a-1){
					rep(j,0,b-1){
						ans[x+i][y+j]=(rec[a][i][j]=='#');
					}
				}
			}
		}
	};
	rep(i,1,n/6){
		rep(j,1,n/6){
			write0((i-1)*6, (j-1)*6);
		}
	}
	rep(i,1,n/6){
		write1((i-1)*6, n/6*6, 6, n%6);
		write1(n/6*6, (i-1)*6, n%6, 6);
	}
	int r=(n-1)%6+1;
	write1(n-r, n-r, 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();
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3880kb

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3600kb

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 = 28, pans = 26 (test case 12)