QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#317448 | #7615. Sequence Folding | nhuang685 | WA | 317ms | 22388kb | C++20 | 1.2kb | 2024-01-29 00:52:06 | 2024-01-29 00:52:07 |
Judging History
answer
/**
* @file qoj7615-1.cpp
* @author n685
* @brief
* @date 2024-01-28
*
*
*/
#include <bits/stdc++.h>
#ifdef LOCAL
#include "dd/debug.h"
#else
#define dbg(...) 42
#define dbgR(...) 4242
#define dbgP(...) 420
#define dbgRP(...) 420420
void nline() {}
#endif
int main() {
#ifdef LOCAL
std::freopen("input.txt", "r", stdin);
std::freopen("output.txt", "w", stdout);
#else
std::cin.tie(nullptr)->sync_with_stdio(false);
#endif
int64_t n;
int m;
std::cin >> n >> m;
std::map<int64_t, int> val;
for (int i = 0; i < m; ++i) {
int p;
std::cin >> p;
--p;
val[p] = 1;
}
int ans = 0;
while (n > 1) {
std::map<int64_t, int> cval = val;
for (auto [aa, bb] : val) {
int64_t a = aa;
if (a >= n) {
continue;
}
if (a >= n / 2 && val.contains(n - 1 - a)) {
continue;
}
if (a >= n / 2) {
a = n - 1 - a;
}
int64_t b = n - 1 - a;
int c = val[a], d = val[b];
if ((c == 0 && d == 1) || (c == 1 && d == 0)) {
++ans;
cval[a] = 2;
} else if (c == 2) {
cval[a] = d;
}
}
val.swap(cval);
n /= 2;
}
std::cout << ans << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3868kb
input:
8 3 1 5 8
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 317ms
memory: 22388kb
input:
17179869184 100000 138476 774165 993977 1152277 1236393 1244970 1534017 1693701 1763926 1778781 1842066 1874644 1885666 2120429 2485344 2977941 3158255 3340476 3504862 4000117 4066652 4197639 4338723 4389163 4576965 4761601 5097091 5175412 5295902 5810551 5855982 6001770 6111262 6163309 6351547 6582...
output:
99998
result:
wrong answer 1st lines differ - expected: '99999', found: '99998'