求调

P11538 [Code+#5] chess

Earth_Sky @ 2025-01-10 20:04:52

rt,Subtesk#2错了

#include<bits/stdc++.h>
using namespace std;
int n,m,k,x,p[1005];
int main(){
    ios::sync_with_stdio(NULL);
    cin.tie(0);cout.tie(0);
    cin>>n>>m>>k;
    for(int i=1;i<=m;i++) cin>>p[i];
    p[m+1]=n+1;while(k--){
        cin>>x;bool flag=false;
        for(int i=1;i<=m+1;i++){
            if(i==x) continue;
            if(p[x]+1==p[i]){
                cout<<"error!"<<endl;
                flag=true;break;
            }
        }
        if(flag) continue;
        cout<<p[x]+1<<endl;
        p[x]=p[x]+1;
    }

    return 0;
}

|