QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#93805 | #5747. Persian Casino | maomao90# | WA | 28ms | 6632kb | C++17 | 2.0kb | 2023-04-02 17:59:45 | 2023-04-02 17:59:46 |
Judging History
answer
// Hallelujah, praise the one who set me free
// Hallelujah, death has lost its grip on me
// You have broken every chain, There's salvation in your name
// Jesus Christ, my living hope
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define RREP(i, s, e) for (int i = (s); i >= (e); i--)
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define SZ(_a) (int) _a.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;
#ifndef DEBUG
#define cerr if (0) cerr
#endif
const int INF = 1000000005;
const ll LINF = 1000000000000000005ll;
const int MAXN = 200005;
const int MOD = 1000000009;
int t;
int n, m;
ll fact[MAXN], ifact[MAXN];
ll ncr(ll n, ll r) {
return fact[n] * ifact[r] % MOD * ifact[n - r] % MOD;
}
int main() {
#ifndef DEBUG
ios::sync_with_stdio(0), cin.tie(0);
#endif
fact[0] = 1;
REP (i, 1, MAXN) {
fact[i] = fact[i - 1] * i % MOD;
}
ifact[0] = ifact[1] = 1;
REP (i, 2, MAXN) {
ifact[i] = MOD - MOD / i * ifact[MOD % i] % MOD;
}
REP (i, 2, MAXN) {
ifact[i] = ifact[i - 1] * ifact[i] % MOD;
}
cin >> t;
while (t--) {
cin >> n >> m;
if (m < 20) {
int cur = 1 << m;
REP (i, m, n) {
cur--;
}
if (cur < 0) {
cout << "bankrupt\n";
continue;
}
}
int ans = 0;
REP (i, 0, m + 1) {
cerr << n << ' ' << i << ": " << ncr(n, i) << '\n';
ans += ncr(n, i);
ans %= MOD;
}
cout << ans << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 6ms
memory: 6580kb
input:
4 2 1 4 1 3 2 57639 34614
output:
3 bankrupt 7 869788168
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 14ms
memory: 6564kb
input:
16460 131 83 137 14 140 28 174 145 87 27 56 11 144 67 88 47 154 59 152 138 100 65 71 43 172 142 113 113 87 68 101 52 179 71 60 51 26 18 97 19 147 111 119 57 124 30 130 37 129 77 177 152 179 84 82 21 162 55 152 2 168 23 139 34 131 101 111 89 179 69 144 30 84 50 150 101 32 24 104 41 137 37 82 59 138 1...
output:
861401790 827411823 937669544 814872401 564368688 774329757 382020028 327399098 136919945 13075099 706031307 579851898 54033422 857164590 919274229 886008600 422741550 229676734 66137152 898506279 95608855 78287335 89291935 599857760 378517272 779874547 58872199 492901833 640116450 bankrupt 73638239...
result:
ok 16460 lines
Test #3:
score: -100
Wrong Answer
time: 28ms
memory: 6632kb
input:
100000 40029 5 1295 16 50862 5 67072 8 51451 4 57967 7 40886 20 13278 1 61885 12 24790 1 80316 2 8554 8 49717 6 82652 8 83139 5 87135 16 7419 8 91357 12 28565 12 80411 1 83723 1 17818 2 36799 20 86016 7 56546 3 92119 10 46290 1 14836 14 63748 1 72859 1 1668 12 99713 23 65337 24 77683 11 36461 2 7810...
output:
bankrupt 670796506 bankrupt bankrupt bankrupt bankrupt 563300247 bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt bankrupt 58529615 bankrupt bankrupt bankrupt bankrupt 402044100 bankrupt bankrupt 966828094 574753812 1719404...
result:
wrong answer 4037th lines differ - expected: '262144', found: '-475783282'