QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#278113#5564. Lots of Landjzh#WA 1ms3472kbC++231.2kb2023-12-07 12:23:142023-12-07 12:23:15

Judging History

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

  • [2023-12-07 12:23:15]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3472kb
  • [2023-12-07 12:23:14]
  • 提交

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;
	}

	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(w, string(l, '0'));

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

			return 0;
		}
	}


	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 4 4

output:

ABCD
ABCD
ABCD
ABCD

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3436kb

input:

6 15 9

output:

AAABBB
AAABBB
AAABBB
CCCDDD
CCCDDD
CCCDDD
EEEFFF
EEEFFF
EEEFFF
GGGHHH
GGGHHH
GGGHHH
IIIJJJ
IIIJJJ
IIIJJJ

result:

wrong answer incorrect output