QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#601558#7407. Program Optimizationrotcar07WA 169ms5956kbC++20664b2024-09-30 07:33:512024-09-30 07:33:51

Judging History

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

  • [2024-09-30 07:33:51]
  • 评测
  • 测评结果:WA
  • 用时:169ms
  • 内存:5956kb
  • [2024-09-30 07:33:51]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,q,k,s;
constexpr int maxn=2e5+5;
int a[maxn],pre[maxn],suf[maxn];
int main(){
    cin>>n>>q>>k>>s;
    mt19937 gen(s);
    int lst=0;
    for(int i=1;i<=n;i++) cin>>a[i];
    pre[0]=suf[n+1]=n;
    for(int i=1;i<=n;i++) pre[i]=min(pre[i-1],a[i]);
    for(int i=n;i>=1;i--) suf[i]=min(suf[i+1],a[i]);
    while(q--){
        int op=gen()%k;
        int i=(gen()+lst)%n;
        if(!op&&i)swap(a[i],a[i+1]),pre[i]=min(pre[i-1],a[i]),suf[i+1]=min(suf[i+1],a[i+1]);
        else{
            int j=gen()%n;i++,j++;
            lst^=min(pre[i-1],suf[j+1]);
        }
    }
    cout<<lst<<'\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3724kb

input:

3 5 1 0
0 1 2

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: -100
Wrong Answer
time: 169ms
memory: 5956kb

input:

200000 10000000 1 664250662
199997 199996 199994 199993 199992 199991 199990 199989 199988 199987 199986 199984 199983 199981 199979 199978 199977 199976 199975 199974 199973 199970 199969 199968 199966 199965 199964 199963 199962 199961 199960 199958 199957 199956 199955 199953 199952 199951 199948...

output:

114482

result:

wrong answer 1st numbers differ - expected: '106138', found: '114482'