ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#206291 | #3701. kry loves 2048 | hujunyi66 | 100 | 4746ms | 67720kb | C++ | 888b | 2024-07-21 18:42:29 | 2024-07-21 20:02:47 |
answer
#include<iostream>
#include<queue>
#include<algorithm>
#define ll long long
#define rint register int
using namespace std;
const int maxn=1e7+10;
ll cnt,n,m;
int a[maxn],b[maxn];
queue<ll>q;
void generate_array(int n, int m, int seed)
{
unsigned x = seed;
for (int i = 0; i < n; ++i) {
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
a[i]=(x % m+ 1);
}
}
inline ll get(){
if(q.empty())
return a[cnt++];
ll f=q.front();
if(cnt==n||a[cnt]>f){
q.pop();
return f;
}
return a[cnt++];
}
int main(){
ios::sync_with_stdio(false);
int seed;
cin>>n>>m>>seed;
generate_array(n,m,seed);
sort(a,a+n);
ll a1,a2;
for(rint i=1;i<=n-1;i++){
a1=get();a2=get();
q.push(max(a1<<1,a2));
}
cout<<q.front()<<'\n';
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1264kb
input:
1 8 611607894
output:
0
result:
ok single line: '0'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1280kb
input:
5 233 913859267
output:
382
result:
ok single line: '382'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1276kb
input:
10 666 926165624
output:
2440
result:
ok single line: '2440'
Test #4:
score: 10
Accepted
time: 8ms
memory: 1720kb
input:
77340 91550 158061800
output:
2596929536
result:
ok single line: '2596929536'
Test #5:
score: 10
Accepted
time: 7ms
memory: 1652kb
input:
60208 94421 221593437
output:
2120744960
result:
ok single line: '2120744960'
Test #6:
score: 10
Accepted
time: 9ms
memory: 1852kb
input:
87789 99755 615454882
output:
3069706240
result:
ok single line: '3069706240'
Test #7:
score: 10
Accepted
time: 1254ms
memory: 67708kb
input:
9999997 1905212 522353336
output:
6956622282752
result:
ok single line: '6956622282752'
Test #8:
score: 10
Accepted
time: 998ms
memory: 67704kb
input:
9999998 3880899 416504703
output:
14171261370368
result:
ok single line: '14171261370368'
Test #9:
score: 10
Accepted
time: 1234ms
memory: 67696kb
input:
9999999 9532351 190334662
output:
34810022068224
result:
ok single line: '34810022068224'
Test #10:
score: 10
Accepted
time: 1236ms
memory: 67720kb
input:
10000000 7456428 463164043
output:
27238560956416
result:
ok single line: '27238560956416'