# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
144218 | 2019-08-16T10:05:20 Z | emilem | Ljetopica (COI19_ljetopica) | C++14 | 4 ms | 380 KB |
#include <algorithm> #include <iostream> #include <vector> #include <string> using namespace std; const long long mod = 1000000007; long long ans = 0; int n, k; string path, a, b; vector<int> pow2(2000); void Solve1(string path) { string res = "1"; for (int i = 0; i < path.length(); ++i) { res.push_back('0'); if (path[i] == 'R') res.back() = '1'; } if (res.length() < a.length() || res.length() > b.length()) return; if (res < a || res > b) return; reverse(res.begin(), res.end()); for (int i = 0; i < res.length(); ++i) if (res[i] == '1') { ans += pow2[i]; ans %= mod; } } int main() { pow2[0] = 1; for (int i = 1; i < pow2.size(); ++i) pow2[i] = (pow2[i - 1] + pow2[i - 1]) % mod; ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> n >> k; cin >> path; cin >> a >> b; if (!k) { Solve1(path); for (int i = 0; i < path.length(); ++i) path[i] = (path[i] == 'L' ? 'R' : 'L'); Solve1(path); cout << ans << endl; } else { } char I; cin >> I; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 380 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 380 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Incorrect | 2 ms | 376 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |