# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
17751 | 2016-01-12T09:57:41 Z | Erzhann | 힘 센 거북 (IZhO11_turtle) | C++ | 6 ms | 636 KB |
/* /\ /\ | ).|.( | | >-< | ========= It's Adilkhan99 miaaaaaau */ #include<bits/stdc++.h> #define ll long long #define pb push_back #define endl "\n" #define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++) #define mp make_pair #define f first #define s second #define name "" #define _ ios_base::sync_with_stdio(false);cin.tie(0); using namespace std; const int MaxN = int (6e5) + 256; const int INF = int(1e9); const int mod = (int)(1e9) + 7; long long n, m, t, k, z; long long f[MaxN]; pair<int, int> p[22]; int main () { _ #ifdef ONLINE_JUDGE freopen (name".in","r",stdin); freopen (name".out","w",stdout); #else freopen (".in","r",stdin); freopen (".out","w",stdout); #endif cin >> n >> m >> k >> t >> z; for(int i = 0; i < k; i++){ int x, y; cin >> x >> y; p[i] = mp(x, y); } sort(p, p + k); f[0] = (1ll); for(int i = 1; i <= n + m; i++){ f[i] = (f[i - 1] * (ll)(i)); } long long ans = f[n + m] / f[n] / f[m]; for(int i = 0; i < (1 << k); i++){ ll cnt = (1ll); int last_i = 0, last_j = 0, kol = 0; bool ok = 1; for(int j = 0; j < k; j++){ if((i & (1 << j))){ if(last_j > p[j].second){ ok = 0; break; } kol++; int I = p[j].first - last_i; int J = p[j].second - last_j; last_i = p[j].first; last_j = p[j].second; cnt = cnt * (f[I + J] / f[I] / f[J]); } } if(kol > t && ok){ int I = n - last_i; int J = m - last_j; cnt = cnt * (f[I + J] / f[I] / f[J]); ans = ans - cnt; } } cout << ans % z; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 604 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
3 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
4 | Runtime error | 5 ms | 604 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
5 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
6 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
7 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
8 | Runtime error | 5 ms | 636 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
9 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
10 | Runtime error | 2 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
11 | Runtime error | 6 ms | 604 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
12 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
13 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
14 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
15 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
16 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
17 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
18 | Runtime error | 5 ms | 572 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
19 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
20 | Runtime error | 5 ms | 632 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |