Contest Duration: ~ (local time) (120 minutes)

Submission #15406622

Source Code Expand

Copy
```#include <bits/stdc++.h>

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
ll a;
in >> a;
o.insert(a);
return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
ll a;
in >> a;
o.push(a);
return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;

int main() {

vector<P> ks;

ll l = 140, r = 170;

rep(i, 55) {
ll tl = l * (1ll << i);
ll tr = r * (1ll << i);

ks.push_back({tl, tr - 1});

}

//    for (P p : ks) {
//        cout << p.first << ' ' << p.second << endl;
//    }

ll c, d;
cin >> c >> d;
d--;

vector<ll> as;
for (P p : ks) {
if (p.first <= c && d <= p.second) {
as.push_back(d - c + 1);
} else if (c <= p.first && p.second <= d) {
as.push_back(p.second - p.first + 1);
} else if (c <= p.first && p.first <= d && d <= p.second) {
as.push_back(d - p.first + 1);
} else if (p.first <= c && c <= p.second && p.second <= d) {
as.push_back(p.second - c + 1);
}
}

ll ans = accumulate(as.begin(), as.end(), 0ll);
cout << ans << endl;

}```

#### Submission Info

Submission Time 2020-07-25 16:32:58+0900 A - Feel the Beat riku_tanide C++ (GCC 9.2.1) 300 1908 Byte AC 6 ms 3608 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01, a02, a03
All 300 / 300 a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15
Case Name Status Exec Time Memory
a01 6 ms 3400 KB
a02 2 ms 3420 KB
a03 3 ms 3580 KB
b04 2 ms 3580 KB
b05 3 ms 3452 KB
b06 1 ms 3424 KB
b07 2 ms 3452 KB
b08 2 ms 3392 KB
b09 2 ms 3608 KB
b10 2 ms 3476 KB
b11 3 ms 3576 KB
b12 3 ms 3608 KB
b13 2 ms 3420 KB
b14 2 ms 3392 KB
b15 2 ms 3504 KB