Submission #1984145
Source Code Expand
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>
using namespace std;
using ll = long long;
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n
const ll MOD = (ll)1e9 + 7;
int main() {
ll N,M;
cin >> N >> M;
if (abs(N - M) > 1LL) return 0;
ll c = 1;
for (ll i = 1; i <= min(N,M); i++) {
c *= (i*i)%MOD;
c %= MOD;
}
if (N == M) c *= 2LL;
if (N != M) c *= max(N, M)%MOD;
c %= MOD;
cout << c << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Reconciled? |
User |
ningenMe |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1590 Byte |
Status |
WA |
Exec Time |
2 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
s1.txt, s2.txt, s3.txt, s4.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
AC |
1 ms |
256 KB |
02.txt |
AC |
2 ms |
256 KB |
03.txt |
AC |
1 ms |
256 KB |
04.txt |
AC |
2 ms |
256 KB |
05.txt |
AC |
1 ms |
256 KB |
06.txt |
WA |
1 ms |
256 KB |
07.txt |
WA |
1 ms |
256 KB |
08.txt |
WA |
1 ms |
256 KB |
09.txt |
AC |
2 ms |
256 KB |
10.txt |
AC |
2 ms |
256 KB |
11.txt |
AC |
1 ms |
256 KB |
12.txt |
AC |
1 ms |
256 KB |
s1.txt |
AC |
1 ms |
256 KB |
s2.txt |
AC |
1 ms |
256 KB |
s3.txt |
WA |
1 ms |
256 KB |
s4.txt |
AC |
2 ms |
256 KB |