# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
624628 | 2022-08-08T14:50:14 Z | Blagoj | Rack (eJOI19_rack) | C++14 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; typedef unsigned long long int ull; typedef long long int ll; typedef long double ld; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); ull n, k, mod = 1000000007; cin >> n >> k; ull dp[n + 1]; dp[0] = 1; for (int i = 1; i <= n; i++) { dp[i] = (dp[i - 1] * 2) % mod; } vector<ull> v = {1, dp[n - 1] + 1}; ull sum = n - 2; if (k == 1) { cout << 1; return 0; } if (k == 2) { cout << v[1]; return 0; } while (sum > 0) { ull sz = v.size(); for (ull i = 0; i < sz; i++) { if ((i + 1) + sz == k) { cout << (ull)(v[i] + dp[sum]) % mod; return 0; } if (sum > 1) { v.push_back((v[i] + dp[sum]) % mod); } } sum--; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |