Submission #5485401


Source Code Expand

///usr/bin/g++ -O2 $0 -o ${0%.cpp} && echo "----------" && ./${0%.cpp}; exit;
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii; 

const int N = 1e5 + 10; 
const int mod = 1e9 + 7; 

int n, m, fact[N]; 

int main(int argc, char const *argv[]) {
    fact[0] = 1; 
    for(int i = 1; i < N; ++i) 
        fact[i] = (ll) fact[i - 1] * i % mod; 

    scanf("%d %d", &n, &m); 

    if(abs(n - m) > 1) puts("0"); 
    else {
        ll ans = (ll) fact[n] * fact[m] % mod;
        if(n == m) ans = 2ll * ans % mod; 
        printf("%lld\n", ans); 
    }
}

Submission Info

Submission Time
Task C - Reconciled?
User RezwanArefin01
Language C++14 (GCC 5.4.1)
Score 300
Code Size 618 Byte
Status AC
Exec Time 3 ms
Memory 640 KB

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:18:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m); 
                           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 16
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 3 ms 640 KB
02.txt AC 2 ms 640 KB
03.txt AC 2 ms 640 KB
04.txt AC 2 ms 640 KB
05.txt AC 2 ms 640 KB
06.txt AC 2 ms 640 KB
07.txt AC 2 ms 640 KB
08.txt AC 2 ms 640 KB
09.txt AC 2 ms 640 KB
10.txt AC 2 ms 640 KB
11.txt AC 2 ms 640 KB
12.txt AC 2 ms 640 KB
s1.txt AC 2 ms 640 KB
s2.txt AC 2 ms 640 KB
s3.txt AC 2 ms 640 KB
s4.txt AC 2 ms 640 KB