QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21254#1266. Visual CubeFudanU1#AC ✓7ms3872kbC++171.6kb2022-03-04 13:57:292022-05-08 02:47:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 02:47:47]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:3872kb
  • [2022-03-04 13:57:29]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, r, l) for (int i = r; i >= l; i--)
#define srep(i, l, r) for (int i = l; i < r; i++)
#define sper(i, r, l) for (int i = r; i > l; i--)
#define maxn 2020
using namespace std;

char out[maxn][maxn];

void plot_diag(int x, int y, char c1, char c2){
	while (x >= 0) {
		out[x][y] = c1;
		x--, y++;
		out[x][y] = c2;
		x--, y++;
	}
}

void plot_diag(int x, int y, char c1, char c2, int rest){
	while (rest) {
		out[x][y] = c1;
		x--, y++;
		out[x][y] = c2;
		x--, y++;
		
		rest--;
	}
}

void work(int a, int b, int c) {
	rep(j, 0, 2 * a + 2 * b){
		rep(i, 0, 2 * b + 2 * c){
			out[i][j] = '.';
		}
	}
	
	int _rest = a, x, y, _y, rest;
	
	y = 0;
	while (_rest){
		x = 2 * b, rest = c;
		while (rest){
			out[x][y] = '+';
			out[x + 1][y] = '|';
			x += 2;
			rest--;
		}
		out[x][y] = '+', y++;
		plot_diag(2 * b - 1, y, '/', '+');
		
		x = 2 * b, rest = c;
		while (rest){
			out[x][y] = '-';
			x += 2;
			rest--;
		}
		out[x][y] = '-', y++;
		plot_diag(2 * b - 1, y, '.', '-');
		
		_rest--;
	}	
	
	x = 2 * b, rest = c;
	while (rest){
		out[x][y] = '+';
		plot_diag(x - 1, y + 1, '/', '+', b);
		out[x + 1][y] = '|';
		plot_diag(x, y + 1, '.', '|', b);
		x += 2;
		rest--;
	}
	out[x][y] = '+', y++;
	plot_diag(x - 1, y, '/', '+', b);
	
	
	rep(i, 0, 2 * b + 2 * c){
		rep(j, 0, 2 * a + 2 * b){
			printf("%c", out[i][j]);
		}
		printf("\n");
	}
}

int main(){
	int T, a, b, c; cin >> T;
	while (T--){
		cin >> a >> b >> c;
		work(a, b, c);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3692kb

input:

2
1 1 1
6 2 4

output:

..+-+
././|
+-+.+
|.|/.
+-+..
....+-+-+-+-+-+-+
.../././././././|
..+-+-+-+-+-+-+.+
./././././././|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/.
+-+-+-+-+-+-+.+..
|.|.|.|.|.|.|/...
+-+-+-+-+-+-+....

result:

ok 18 lines

Test #2:

score: 0
Accepted
time: 7ms
memory: 3872kb

input:

50
16 19 7
1 8 12
5 15 16
12 9 14
9 2 11
8 11 8
2 1 20
8 16 3
2 7 1
3 17 7
13 13 11
5 9 5
11 10 3
19 4 6
13 17 9
9 17 8
14 3 11
9 4 2
9 6 5
4 9 1
12 8 18
4 7 2
13 3 9
1 13 17
17 11 3
9 2 13
5 7 2
6 18 14
14 14 11
5 12 14
16 7 1
5 19 10
16 9 1
9 8 6
11 7 18
12 20 10
10 16 13
17 12 9
9 9 17
10 2 12
1 ...

output:

......................................+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
...................................../././././././././././././././././|
....................................+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+.+
.................................../././././././././././././././././|/|
...............

result:

ok 1988 lines