結果
問題 | No.1450 nahco314's First Problem |
ユーザー |
|
提出日時 | 2021-03-31 14:52:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 2,830 bytes |
コンパイル時間 | 1,748 ms |
コンパイル使用メモリ | 166,556 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 14:15:33 |
合計ジャッジ時間 | 3,216 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
// Created at 2021/03/31 14:00// {TODO}WA, {TODO}min, {TODO}diff// goal: {TODO}min#include <bits/stdc++.h>//#include <atcoder/all>#pragma GCC target("avx2")#pragma GCC optimize("O3")#pragma GCC optimize("unroll-loops")#define overload4(_1,_2,_3,_4,name,...) name#define rep(i, n) for (lint i = 0, i##_lim = n; i < i##_lim; i++)#define rep2(i, n) for (lint i = 1, i##_lim = n; i <= i##_lim; i++)#define rep3(i, s, e) for (lint i = s, i##_lim = e; i < i##_lim; i++)#define all(i) (i).begin(), (i).end()#define print1(s) cout << (s) << '\n';#define print2(s1, s2) cout << (s1) << ' ' << (s2) << '\n';#define print3(s1, s2, s3) cout << (s1) << ' ' << (s2) << ' ' << (s3) << '\n';#define print4(s1, s2, s3, s4) cout << (s1) << ' ' << (s2) << ' ' << (s3) << ' ' << (s4) << '\n';#define print(...) overload4(__VA_ARGS__, print4, print3, print2, print1)(__VA_ARGS__)using namespace std;//using namespace atcoder;using lint = long long;using ld = long double;using pi = pair<int, int>;using pl = pair<lint, lint>;using vi = vector<int>;using vl = vector<lint>;using vvi = vector<vi>;using vvl = vector<vl>;using vpi = vector<pi>;using vpl = vector<pl>;using qi = queue<int>;using ql = queue<lint>;using qpi = queue<pi>;constexpr int INF = 1 << 30;constexpr lint INFl = 1LL << 62;template<class T, class U>istream &operator>>(istream &is, pair<T, U> &pair) {is >> pair.first >> pair.second;return is;}template<class T, class U>ostream &operator<<(ostream &os, pair <T, U> &pair) {os << pair.first << ' ' << pair.second;return os;}template<class T>istream &operator>>(istream &is, vector<T> &vec) {for (auto &v : vec) is >> v;return is;}template<class T>ostream &operator<<(ostream &os, const vector<T> &vec) {os << '[';for (auto v : vec) os << v << ", ";os << ']';return os;}template<class T>inline bool chmax(T &a, T b) {if (b > a) {a = b;return true;}return false;}template<class T>inline bool chmin(T &a, T b) {if (b < a) {a = b;return true;}return false;}int popcount(lint x) {int rtn = 0;while (x) {if (x & 1) rtn++;x >>= 1;}return rtn;}int main() {ios::sync_with_stdio(false);cin.tie(nullptr);// cout << fixed << setprecision(15);// 二分探索// 全探索// 動的計画法// 逆からたどる// ネットワークフロー// 二部マッチング// ggrks/*----------------------------------------------------*/lint x; cin >> x;rep(weight, 60) {lint n = x ^ weight;if (popcount(n) == weight && n >= 1 && n <= 2000000000000000000LL) {print(n)return 0;}}print(-1)// 最大値は?}