Submission #1268868

#TimeUsernameProblemLanguageResultExecution timeMemory
1268868discontinuousKangaroo (CEOI16_kangaroo)C++20
0 / 100
9 ms12100 KiB
// Author: Anikait Prasar

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define pb push_back

void setIO(string name = "") {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if (!name.empty()) {
        freopen((name + ".in").c_str(), "r", stdin);
        freopen((name + ".out").c_str(), "w", stdout);
    }
}

const ll MOD = 1e9 + 7;
const ll INF = 1e15;
const ll N = 1e6;

ll n, m, k, a, b, c, d, h, l, r, q, x, y;


ll modPow(ll x, ll n) {
    ll res = 1;
    while(n >= 1) {
        if(n & 1) {
            res = (res * x) % MOD;            
            n--;  
        }        
        else {
            x = (x * x) % MOD;
            n /= 2;
        }
    }
    return res;
}

ll modInv(ll num) { return modPow(num, MOD - 2); }

int lastSetBit(ll num) {
    if(num==0) {
        return -1;
    }
    for(int j = 0; j<60; j++) {
        if((1LL << j) & num) {
            return j; 
        }
    }

    return 0; // to avoid warning
}
int firstSetBit(ll num) {
    if(num==0) {
        return -1;
    }
    for(int j = 60; j>=0; j--) {
        if((1LL << j) & num) {
            return j; 
        }
    }

    return 0; // to avoid warning
}

vector<int> arr(N);
vector<int> brr(N);

vector<int> adj[N+1];
vector<int> visited(N);


void dfs(int node) {
    visited[node] = true;
    for(auto j : adj[node]) {
        if(!visited[j]) dfs(j);
    }
}


void solve() {
    cin >> n >> l >> r;

    ll ans = 1;
    for(int j = n-2; j>=1; j--) {
        ans = (ans*j)%MOD;
    }

    cout << ans;
}

/**
----------------------------------------------------
Problem Notes :-


----------------------------------------------------
**/

int main() {
    ios::sync_with_stdio(false);
    cout.tie(0); cin.tie(0);

    int tc = 1; 
    // cin >> tc;

    while(tc--) {
        solve();
        // cout << "\n";
    }

    return 0;
}

Compilation message (stderr)

kangaroo.cpp: In function 'void setIO(std::string)':
kangaroo.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen((name + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen((name + ".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...