比赛 2025.12.13 评测结果 AAAAAAAAAAWWWEEEEEEE
题目名称 排列变换 最终得分 50
用户昵称 梦那边的没好TM 运行时间 1.580 s
代码语言 C++ 内存使用 3.61 MiB
提交时间 2025-12-13 11:56:08
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define cpy(a,b) copy(begin(a),end(a),begin(b))
#define ld long double
#define dot(x) fixed<<setprecision(x)
#define foru(a,b,c) for(ll a=b;a<=c;a++)

ll n,a[5005];

int main(){
    freopen("permutrans.in" ,"r",stdin );
    freopen("permutrans.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cin>>n;
    foru(i,1,n){
        cin>>a[i];
    }
    ll ma=-1,t;
    foru(i,0,n-1){
        ll cnt=0;
        foru(j,1,n){
            ll pos=j-i;
            if(pos<=0)pos+=n;
            if(a[pos]>=j)cnt++;
        }
        if(cnt>ma){
            ma=cnt;
            t=i;
        }
    }
    cout<<ma<<" "<<t;
    return 0;
}