QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239132#7688. Alea Iacta Estucup-team2303#WA 4ms3588kbC++141.4kb2023-11-04 18:46:162023-11-04 18:46:16

Judging History

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

  • [2023-11-04 18:46:16]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3588kb
  • [2023-11-04 18:46:16]
  • 提交

answer

/*
60 + 0 + 100 + 64 = 224.
*/

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define L(i, j, k) for (int i = (j); i <= (k); i++)
#define R(i, j, k) for (int i = (j); i >= (k); i--)
#define pb push_back
#define pii pair<int, int>
inline int read()
{
	int sum = 0, nega = 1;
	char ch = getchar();
	while (ch > '9'||ch < '0')
	{
	    if (ch == '-') nega = -1;
		ch = getchar();
	}
	while (ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
	return sum * nega;
}
const int N = 1e6 + 9, mod = 998244353;
inline void add(int &x, int y) {x = (x + y) % mod;}
inline void del(int &x, int y) {x = (x - y + mod) % mod;}
int T, x, y;
inline void work(int x, int y, int a, int b)
{
	printf("%lld ", a);
	L(i, 1, a) printf("%lld ", i); puts("");
	printf("%lld ", b);
	int nw = 1;
	L(i, 1, b / y)
	{
		L(j, 1, y) printf("%lld ", nw + j - 1);
		nw += a;
	}
	puts(""); return ;
}
inline void solve()
{
	x = read(), y = read();
	int t = x * y, f = sqrt(t);
	R(i, f, 1)
	{
		if(t % i != 0) continue;
		int a = i, b = t / i;
		if(x % a == 0) {work(x, y, a, b); return ;}
		if(y % a == 0) {swap(x, y), work(x, y, a, b); return ;}
		if(x % b == 0) {swap(a, b), work(x, y, a, b); return ;}
		if(y % b == 0) {swap(a, b), swap(x, y); work(x, y, a, b); return ;}
	}
	puts("0"); puts("0");
	return ;
}
signed main()
{
	T = read();
	L(i, 1, T) solve();
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
2 8
1 9
2 9

output:

4 1 2 3 4 
4 1 2 5 6 
3 1 2 3 
3 1 4 7 
3 1 2 3 
6 1 2 4 5 7 8 

result:

ok Correct. (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 3512kb

input:

1
40013 40013

output:

40013 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 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 90 91 92 93 94 95 96 97 98 99 100 10...

result:

wrong answer Same as input (test case 1)