QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#638710 | #7407. Program Optimization | icealsoheat | WA | 1ms | 5728kb | C++20 | 2.1kb | 2024-10-13 16:41:20 | 2024-10-13 16:41:20 |
Judging History
answer
#pragma GCC optimize(3) //O2优化开启
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
const int mod=998244353;
// const int MX=0x3f3f3f3f3f3f3f3f;
int n,q,k,s;
int a[1000005];
int le[1000005];
int re[1000005];
void icealsoheat(){
cin>>n>>q>>k>>s;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++){
le[i]=min(le[i-1],a[i]);
}
re[n+1]=le[0]=n;
for(int i=n;i>=1;i--){
re[i]=min(re[i+1],a[i]);
}
mt19937 gen(s);
// gen.seed(s);
int last=0;
while(q--){
int op=gen()%k;
int i=(gen()+last)%n;
i++;
if(!op&&i>1){
swap(a[i-1],a[i]),le[i-1]=min(le[i-2],a[i-1]),le[i]=min(a[i],le[i-1]);
re[i]=min(re[i+1],a[i]);
re[i-1]=min(re[i],a[i-1]);
}
else{
int j=gen()%k;
j++;
last^=min(le[min(i,j)-1],re[max(i,j)+1]);
}
}
cout<<last;
}
signed main(){
ios::sync_with_stdio(false); //int128不能用快读!!!!!!
cin.tie();
cout.tie();
int _yq;
_yq=1;
// cin>>_yq;
while(_yq--){
icealsoheat();
}
}
//
//⠀⠀⠀ ⠀⢸⣿⣿⣿⠀⣼⣿⣿⣦⡀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀⠀ ⠀⢸⣿⣿⡟⢰⣿⣿⣿⠟⠁
//⠀⠀⠀⠀⠀⠀⠀⢰⣿⠿⢿⣦⣀⠀⠘⠛⠛⠃⠸⠿⠟⣫⣴⣶⣾⡆
//⠀⠀⠀⠀⠀⠀⠀⠸⣿⡀⠀⠉⢿⣦⡀⠀⠀⠀⠀⠀⠀ ⠛⠿⠿⣿⠃
//⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⠀⠀⠹⣿⣶⡾⠛⠛⢷⣦⣄⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣧⠀⠀⠈⠉⣀⡀⠀ ⠀⠙⢿⡇
//⠀⠀⠀⠀⠀⠀⢀⣠⣴⡿⠟⠋⠀⠀⢠⣾⠟⠃⠀⠀⠀⢸⣿⡆
//⠀⠀⠀⢀⣠⣶⡿⠛⠉⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⠀⠀⢸⣿⠇
//⢀⣠⣾⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣼⣧⣀⠀⠀⠀⢀⣼⠇
//⠈⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡿⠋⠙⠛⠛⠛⠛⠛⠁
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣾⡿⠋⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⢾⠿⠋⠀
//
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5728kb
input:
3 5 1 0 0 1 2
output:
0
result:
wrong answer 1st numbers differ - expected: '3', found: '0'