답안 #1041621

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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++)
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -