Submission #1041621

# Submission time Handle Problem Language Result Execution time Memory
1041621 2024-08-02T06:22:34 Z vjudge1 Ljetopica (COI19_ljetopica) C++17
8 / 100
1 ms 348 KB
#include<bits/stdc++.h>

using namespace std;

const int mod = 1'000'000'007;
int N, K;
string s, a, b;

bool small(string a, string b)
{
  for(int i = 0; i < a.size(); i++)
    if(a[i] != b[i])
      return a[i] < b[i];
  return false;
}

int val(string s)
{
  int hsh = 0;
  for(char i : s)
    hsh = (hsh * 2ll + (i - '0')) % mod;
  return hsh;
}

void subtask1()
{
  string ans1 = "1", ans2 = "1";
  for(char i : s)
    {
      if(i == 'L')
	ans1 += '0', ans2 += '1';
      else
	ans1 += '1', ans2 += '0';
    }

  int ans = 0;

  if(!small(ans1, a) && !small(b, ans1))
    ans = (ans + val(ans1)) % mod;
  if(!small(ans2, a) && !small(b, ans2))
    ans = (ans + val(ans2)) % mod;
  cout << ans << endl;
  exit(0);
}

void subtask2()
{
}
int main()
{

  cin >> N >> K >> s >> a >> b;
  if(K == 0)
    subtask1();
  subtask2();
  return 0;
}

Compilation message

ljetopica.cpp: In function 'bool small(std::string, std::string)':
ljetopica.cpp:11:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   for(int i = 0; i < a.size(); i++)
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -