QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#54580#4184. Amusement ArcadeUsername#WA 3ms3632kbC++1.2kb2022-10-09 19:28:292022-10-09 19:28:31

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-09 19:28:31]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3632kb
  • [2022-10-09 19:28:29]
  • 提交

answer

#ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("popcnt,abm,mmx,avx2")
#endif
#include <bits/stdc++.h>

using namespace std;

#define popCnt(x) (__builtin_popcountll(x))
#define sz(x) ((int)(x.size()))
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
#define rep(i, l, r) for (int i = l; i < r; ++i)
using Long = long long;
using Double = double;
using vi = vector<int>;

template <class U, class V>
istream& operator>>(istream& is, pair<U, V>& p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& x : v) {
    is >> x;
  }
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (auto& x : v) {
    os << x << " ";
  }
  return os;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
  freopen("test.out", "w", stdout);
#else
#define endl '\n'
#endif
  Long n;
  cin >> n;
  for (Long p = 2; p + 1 <= n; p *= 2) {
    if (popCnt(n - p - 1) <= 1) {
      cout << p + 1 << endl;
      // return 0;
    }
  }
  cout << "impossible" << endl;
  return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 3632kb

input:

7

output:

3
5
impossible

result:

wrong output format Extra information in the output file