답안 #147629

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147629 2019-08-30T10:28:02 Z xDWaffle Ljetopica (COI19_ljetopica) C++11
0 / 100
3 ms 376 KB
#include <bits/stdc++.h>
#define ff(j, a, b) for(int j=a;j<b;j++)
#define pb push_back;

using namespace std;

typedef long long ll;

ll n, k;
ll a, b, path;

ll check_pathing(ll x)
{
    return (x<=b && x>=a) ? x : 0;
}

void load_path()
{
    path=pow(2, n-1);
    ff(j, 0, n-1)
    {
        char tmp;
        cin >> tmp;
        if(tmp=='R')
        {
            path+=pow(2, n-2-j);
        }
    }
}

ll bin_string_to_ll(string s)
{

    ll res=1;
    ff(j, 1, s.size())
    {
       res=res*2;
       if(s[j]=='1')
       {
            res++;
       }
    }
    return res;
}



int main()
{
    cin >> n >> k;
    load_path();
    string tmpstrng;
    cin >> tmpstrng;
    a=bin_string_to_ll(tmpstrng);
    cin >> tmpstrng;
    b=bin_string_to_ll(tmpstrng);
    ///zavrseno ucitavanje!!

    /// XOR <=> ^

    ll altpath= ((1 << (n-1))-1) ^ path;

    cout << check_pathing(path) + check_pathing(altpath);
    return 0;
}

Compilation message

ljetopica.cpp: In function 'll bin_string_to_ll(std::__cxx11::string)':
ljetopica.cpp:2:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define ff(j, a, b) for(int j=a;j<b;j++)
ljetopica.cpp:35:8:
     ff(j, 1, s.size())
        ~~~~~~~~~~~~~~             
ljetopica.cpp:35:5: note: in expansion of macro 'ff'
     ff(j, 1, s.size())
     ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -