QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499007 | #9133. Function with Many Maximums | ucup-team3215 | AC ✓ | 22ms | 9212kb | C++20 | 951b | 2024-07-30 22:56:27 | 2024-07-30 22:56:28 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
int64_t l = 1e11, c = 446000, k = 0;
vector<int64_t> a;
while (1) {
bool ok = 0;
for (int b = 1; b < 5; ++b) {
int64_t d = (2 * l * b + c - b - 1) / (c - b), req = d * (c - b) - 2 * l * b, s = 0, mx = d;
if (l + d >= 1e12) break;
a.resize(a.size() + b);
for (int k = b; k--; ) {
int64_t m = min(min(req, mx - 1), (d * (c - b) - l * (b - k + 1) - s) / (c - k + 1));
mx = m;
if (req && !(k && m) || m < 0) break;
a.end()[k - b] = l + m;
s += l + m;
req -= m;
if (!k) ok = 1;
}
if (ok) { l += d, c -= b, ++k; break; }
else a.resize(a.size() - b);
}
if (!ok) break;
}
for (int i = 0; i < c; ++i) a.push_back(a.back() + 1);
cout << a.size() << '\n';
for (auto& a: a) cout << a << ' ';
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 22ms
memory: 9212kb
input:
4
output:
446000 100000000000 100000442268 100000896866 100001309890 100001793744 100002177428 100002690634 100003044882 100003587536 100003912252 100004484450 100004779538 100005381376 100005646740 100006278314 100006513858 100007175264 100007380892 100008072226 100008247842 100008969200 100009114708 1000098...
result:
ok n=446000, max_a=999956632604, max_num=152482 >= 4
Test #2:
score: 0
Accepted
time: 21ms
memory: 8104kb
input:
100000
output:
446000 100000000000 100000442268 100000896866 100001309890 100001793744 100002177428 100002690634 100003044882 100003587536 100003912252 100004484450 100004779538 100005381376 100005646740 100006278314 100006513858 100007175264 100007380892 100008072226 100008247842 100008969200 100009114708 1000098...
result:
ok n=446000, max_a=999956632604, max_num=152482 >= 100000
Extra Test:
score: 0
Extra Test Passed