QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21549#2851. 生生不息gogo#AC ✓2ms3584kbC++201.2kb2022-03-07 14:58:022022-05-08 03:37:32

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 03:37:32]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3584kb
  • [2022-03-07 14:58:02]
  • 提交

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 trv(i, u, v) for(int i = head[u], v = e[i].to; i; v = e[i = e[i].nxt].to)
#define fi first
#define se second
#define all(s) s.begin(), s.end()
#define sz(s) (int)(s.size())
#define lb(s) ((s) & -(s))
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
mt19937_64 hua(time(0));
template<typename T> inline bool chkmx(T &x, T y) {return x < y ? x = y, 1 : 0;}
template<typename T> inline bool chkmn(T &x, T y) {return y < x ? x = y, 1 : 0;}
template<int T> using A = array<int, T>;

inline int read() {
	int x = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar()) if(c == '-')  f = 0;
	for(; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	return f ? x : -x;
}
int ans[6][6];
int main() {
//	freopen("in.txt", "r", stdin);
	ans[2][2] = 5;
	ans[2][3] = 18;
	ans[3][3] = 150;
	ans[2][4] = 73;
	ans[3][4] = 1533;
	ans[4][4] = 31828;
	ans[5][5] = 12785753;
	ans[4][5] = 469972;
	ans[3][5] = 11398;
	ans[2][5] = 267;
	for(int T = read(); T; T --) {
		int n = read(), m = read();
		if(n > m) swap(n, m);
		cout << ans[n][m] << '\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3584kb

input:

25
2 4
2 3
2 1
1 5
4 2
5 4
5 3
2 5
1 4
4 4
5 2
5 1
4 5
3 3
3 2
4 3
5 5
3 1
4 1
3 5
3 4
1 3
1 2
2 2
1 1

output:

73
18
0
0
73
469972
11398
267
0
31828
267
0
469972
150
18
1533
12785753
0
0
11398
1533
0
0
5
0

result:

ok 25 lines