Submission #144218

#TimeUsernameProblemLanguageResultExecution timeMemory
144218emilemLjetopica (COI19_ljetopica)C++14
8 / 100
4 ms380 KiB
#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 (stderr)

ljetopica.cpp: In function 'void Solve1(std::__cxx11::string)':
ljetopica.cpp:16:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < path.length(); ++i)
                  ~~^~~~~~~~~~~~~~~
ljetopica.cpp:27:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < res.length(); ++i)
                  ~~^~~~~~~~~~~~~~
ljetopica.cpp: In function 'int main()':
ljetopica.cpp:37:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < pow2.size(); ++i)
                  ~~^~~~~~~~~~~~~
ljetopica.cpp:48:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < path.length(); ++i)
                   ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...