# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
145519 | 2019-08-20T10:29:23 Z | saken03 | Ljetopica (COI19_ljetopica) | C++14 | 3 ms | 504 KB |
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second using namespace std; //template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; typedef long long ll; using namespace __gnu_pbds; const int MOD = (int)1e9 + 7; int n, k; string s; vector<string> v; void solve() { cin >> n >> k; cin >> s; assert(k == 0); string a1, b1; cin >> a1 >> b1; ll sum = 0, pt = 1; string t = "1"; for (int i = 0; i < n - 1; i++) { if (s[i] == 'L') { t += '0'; } else t += '1'; } v.pb(t); t = "1"; for (int i = 0; i < n - 1; i++) { if (s[i] == 'L') { t += '1'; } else t += '0'; } v.pb(t); for (auto it : v) { if (a1 <= it && it <= b1) { int p = 1; for (int i = 0; i < it.size(); ++i) { if (it[it.size() - 1 - i] == '1') { sum = (sum + p) % MOD; } p = (p + p) % MOD; } } } cout << sum << '\n'; } int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int tt = 1; while (tt--) { solve(); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 380 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 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 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 380 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |