QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#495669 | #9133. Function with Many Maximums | ucup-team3586# | AC ✓ | 54ms | 18292kb | C++23 | 1.5kb | 2024-07-27 23:00:31 | 2024-07-27 23:00:31 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n=100005;
vector<ll> vec;
for(int i=1;i<=100000;i++)
vec.pb(1000000000000-i+1);
vec.pb(999999999999-100000);
int p=100001;
for(int i=1;i<=n;i++)
{
// if(vec.back()%(p+2)==0)
// vec.pb(vec.back()/((p++)+2));
// else
{
ll val=vec.back()*p/(p+4);
vec.pb(vec.back()*p-val*(p+3));
vec.pb(val);
p+=2;
}
}
rev(vec);
srt(vec);
cout<<sz(vec)<<'\n';
for(auto x:vec)
cout<<x<<" ";
for(int i=1;i<sz(vec);i++)
assert(vec[i-1]!=vec[i]);
ll sum=accumulate(ALL(vec),0ll);
map<ll,int> Mp;
for(int i=0;i<sz(vec);i++)
{
Mp[sum+vec[i]*(sz(vec)-i)]++;
sum-=vec[i];
}
pair<ll,int> pp;
for(auto pr:Mp)
if(pr.first>pp.first)
pp=pr;
cerr<<pp.first<<" "<<pp.second<<endl;
assert(pp.second>=100001);
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 47ms
memory: 18152kb
input:
4
output:
300011 111106631782 111106837056 111108113160 111108130369 111109594567 111109723484 111111076004 111111316389 111112557471 111112609083 111114038967 111114201573 111115520493 111115793853 111117002049 111117085928 111118483634 111118677793 111119965249 111119969457 111121446893 111121560907 1111229...
result:
ok n=300011, max_a=1000000000000, max_num=100006 >= 4
Test #2:
score: 0
Accepted
time: 54ms
memory: 18292kb
input:
100000
output:
300011 111106631782 111106837056 111108113160 111108130369 111109594567 111109723484 111111076004 111111316389 111112557471 111112609083 111114038967 111114201573 111115520493 111115793853 111117002049 111117085928 111118483634 111118677793 111119965249 111119969457 111121446893 111121560907 1111229...
result:
ok n=300011, max_a=1000000000000, max_num=100006 >= 100000
Extra Test:
score: 0
Extra Test Passed