QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#278120#5564. Lots of Landjzh#RE 1ms3504kbC++231.2kb2023-12-07 12:26:462023-12-07 12:26:47

Judging History

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

  • [2023-12-07 12:26:47]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3504kb
  • [2023-12-07 12:26:46]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using db = long double;

struct M{
	array<array<db, 2>, 2> A;
	M operator * (const M& t) const {
		decltype(A) ans = {0,0,0,0};
		for(int i = 0 ; i < 2 ; i ++) {
			for(int j = 0 ; j < 2 ; j ++) {
				for(int k = 0 ; k < 2 ; k ++) {
					ans[i][j] += A[i][k] * t.A[k][j];
				}
			}
		}
		return M{ans};
	}
};

M POW(M a, ll k) {
	M ans = {1, 0, 0, 1};
	for(; k; k/=2, a = a * a) {
		if(k&1) ans = ans * a;
	}
	return ans;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);

	int l, w, n; cin >> l >> w >> n;
	if(l*w%n!=0) {
		cout << "impossible" << endl;
		return 0;
	}
	n = l * w / n;

	for(int i = 1 ; i <= n ; i ++) {
		if(n%i) continue;
		if(l%i==0 and w%(n/i)==0) {
			int a = i, b = n/i;
			vector<string>g(l, string(w, '0'));

			int tot = 0;
			for(int i = 0 ; i < l ; i += a) {
				for(int j = 0 ; j < w ; j += b) {
					for(int x = i ; x < i + a ; x ++) {
						for(int y = j ; y < j + b ; y ++) {
							g[x][y] = 'A' + tot;
						}
					}
					tot++;
				}
			}
			for(int i = 0 ; i < w ; i ++) cout << g[i] << endl;

			return 0;
		}
	}
	assert(false);

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3424kb

input:

4 4 4

output:

AAAA
BBBB
CCCC
DDDD

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3484kb

input:

6 15 9

output:

AAAAABBBBBCCCCC
AAAAABBBBBCCCCC
DDDDDEEEEEFFFFF
DDDDDEEEEEFFFFF
GGGGGHHHHHIIIII
GGGGGHHHHHIIIII

result:

ok correct

Test #3:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

100 100 26

output:

impossible

result:

ok correct

Test #4:

score: 0
Accepted
time: 1ms
memory: 3444kb

input:

1 1 1

output:

A

result:

ok correct

Test #5:

score: -100
Runtime Error

input:

1 100 25

output:

AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYY

result: