QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#624565 | #9133. Function with Many Maximums | ticking_away# | AC ✓ | 28ms | 11096kb | C++20 | 2.1kb | 2024-10-09 16:07:47 | 2024-10-09 16:07:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
#define endl '\n'
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int maxn = 2e5 + 10;
const int mod = 1000000007;
#define inl inline
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define ford(i, a, b) for (int i = a; i >= b; i--)
#define forall(i, a) for (auto &i : a)
/**
____ ___ _____
/ ___| _ _ / _ \___ /
\___ \| | | | | | ||_ \
___) | |_| | |_| |__) |
|____/ \__, |\___/____/
|___/
*/
istream &operator>>(istream &in, vector<int> &v)
{
for (auto &i : v)
in >> i;
return in;
}
ostream &operator<<(ostream &out, vector<int> &v)
{
for (auto &i : v)
out << i << " ";
return out;
}
bool _output = 0;
#define int long long
void solve()
{
int b;
cin >> b;
int n = 5e5;
vector<int> a(2 * n + 2);
auto make = [](int a, int b)
{
return (a + b - 1) / b;
};
a[0] = 293309723580;
fr(i, 0, 2 * b - 2)
{
int t1 = make(4 * a[i], n - i - 1);
a[i + 1] = a[i] + t1 * (n - i - 1) - 4 * a[i];
a[i + 2] = a[i] + t1;
i++;
}
cout << n << endl;
fr(i, 2 * b, n - 1)
{
a[i + 1] = a[i] + 1;
}
fr(i, 2, n)
{
if (a[i] <= a[i - 1])
{
assert(0);
cout << "Error 1: " << i << " \n";
}
if (a[i] > 1e12)
{
assert(0);
cout << "Error 2: " << i << " \n";
}
}
fr(i, 1, n) cout << a[i] << " ";
cout << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int _ = 1;
if (_output)
cin >> _;
// int l = 1e11, r = 3e11;
// int ans = -1;
// while (l <= r)
// {
// int mid = (l + r) / 2;
// if (solve(mid))
// {
// ans = mid;
// l = mid + 1;
// }293309723580
// }
// }
// cout << ans << endl;
solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 26ms
memory: 11096kb
input:
4
output:
500000 293309982777 293312070063 293312250278 293314416574 293314517583 293316763113 293316784692 293319109680 293319109681 293319109682 293319109683 293319109684 293319109685 293319109686 293319109687 293319109688 293319109689 293319109690 293319109691 293319109692 293319109693 293319109694 2933191...
result:
ok n=500000, max_a=293319609672, max_num=4 >= 4
Test #2:
score: 0
Accepted
time: 28ms
memory: 11008kb
input:
100000
output:
500000 293309982777 293312070063 293312250278 293314416574 293314517583 293316763113 293316784692 293319109680 293319551596 293321456276 293321818308 293323802900 293324084824 293326149552 293326351144 293328496232 293328617268 293330842940 293330883196 293333189676 293333648907 293335536441 2933359...
result:
ok n=500000, max_a=814745277826, max_num=100000 >= 100000
Extra Test:
score: 0
Extra Test Passed