QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#580481 | #9378. Strange Binary | HalloWorld | WA | 7ms | 3700kb | C++20 | 1.3kb | 2024-09-21 22:05:22 | 2024-09-21 22:05:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define bit(a) (1 << a)
#define lowbit(a) (a & (-a))
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(a) cout << #a << ":" << a << endl
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef unsigned long long ull;
typedef vector<vector<int>> vvi;
typedef vector<array<int, 2>> va2;
constexpr int N = 1000010;
constexpr int INF = 2e9;
constexpr ll LLF = 2e18;
constexpr ll mod = 998244353;
constexpr int dir[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
ll powmod(ll a,ll b,ll mod=mod) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll inv(ll a){return powmod(a,mod-2);}
void solve() {
ll n; cin >> n;
if (n % 2 == 0) {
cout << "NO\n";
return;
}
cout << "YES\n";
auto k = (n - 1) / 2;
for (int i = 0; i <= 30; i++) {
if ((1ll << i) & k) {
cout << "1";
} else {
cout << "-1";
}
if ((i + 1) % 8 == 0) {
cout << "\n";
} else {
cout << " ";
}
}
cout << "1\n";
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
// cout << fixed << setprecision(10);
int testcase; cin >> testcase; for (int _ = 1; _ <= testcase; _++)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3700kb
input:
3 0 3 5
output:
NO YES 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 YES -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1
result:
ok Accepted! (3 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
2 0 1073741823
output:
NO YES 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 1
result:
ok Accepted! (2 test cases)
Test #3:
score: -100
Wrong Answer
time: 7ms
memory: 3648kb
input:
10000 324097321 555675086 304655177 991244276 9980291 383616352 1071036550 795625380 682098056 68370721 969101726 685975156 973896269 354857775 196188000 606494155 754416123 467588829 495704303 558090120 618002000 491488050 741575237 9937018 10028830 140094825 652839595 357724903 516690123 817724271...
output:
YES -1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 1 NO YES -1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 NO YES 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 NO NO NO NO YES -1 -1 -1 -1 ...
result:
wrong answer Jury's answer is YES, but Participant's answer is NO. (test case 10000)