QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#638690#7407. Program OptimizationicealsoheatWA 1ms5704kbC++202.1kb2024-10-13 16:38:002024-10-13 16:38:02

Judging History

你现在查看的是最新测评结果

  • [2024-10-13 16:38:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5704kb
  • [2024-10-13 16:38:00]
  • 提交

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;
    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-1],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[min(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: 5704kb

input:

3 5 1 0
0 1 2

output:

0

result:

wrong answer 1st numbers differ - expected: '3', found: '0'