結果
| 問題 |
No.1286 Stone Skipping
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2020-11-13 23:17:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,813 bytes |
| コンパイル時間 | 2,057 ms |
| コンパイル使用メモリ | 191,808 KB |
| 最終ジャッジ日時 | 2025-01-16 00:06:56 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 20 WA * 6 |
ソースコード
#include <bits/stdc++.h>
#pragma region my_template
struct Rep {
struct I {
int i;
void operator++() { ++i; }
int operator*() const { return i; }
bool operator!=(I o) const { return i < *o; }
};
const int l, r;
Rep(int _l, int _r) : l(_l), r(_r) {}
Rep(int n) : Rep(0, n) {}
I begin() const { return {l}; }
I end() const { return {r}; }
};
struct Per {
struct I {
int i;
void operator++() { --i; }
int operator*() const { return i; }
bool operator!=(I o) const { return i > *o; }
};
const int l, r;
Per(int _l, int _r) : l(_l), r(_r) {}
Per(int n) : Per(0, n) {}
I begin() const { return {r - 1}; }
I end() const { return {l - 1}; }
};
template <class F>
struct Fix : private F {
Fix(F f) : F(f) {}
template <class... Args>
decltype(auto) operator()(Args&&... args) const {
return F::operator()(*this, std::forward<Args>(args)...);
}
};
template <class T = int>
T scan() {
T res;
std::cin >> res;
return res;
}
template <class T, class U = T>
bool chmin(T& a, U&& b) {
return b < a ? a = std::forward<U>(b), true : false;
}
template <class T, class U = T>
bool chmax(T& a, U&& b) {
return a < b ? a = std::forward<U>(b), true : false;
}
#ifndef LOCAL
#define DUMP(...) void(0)
template <int OnlineJudge, int Local>
constexpr int OjLocal = OnlineJudge;
#endif
using namespace std;
#define ALL(c) begin(c), end(c)
#pragma endregion
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cout << fixed << setprecision(20);
auto d = scan<int64_t>();
for (int64_t x = max<int64_t>(d / 2 - 100, 1); x <= min(d / 2 + 100, d);
++x) {
if (2 * x - __builtin_popcountll(x) >= d) {
cout << x << '\n';
exit(0);
}
}
}
risujiroh