Submission #75707122


Source Code Expand

#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
int n,m;
int _;
int a[(int)6e5+10];
const int mod=998244353;
signed main(){
    cin>>_;
    while(_--){
        cin>>n;
        int ans=0;
        int falg=1;
        for(int i=1;i<=n;i++){
            cin>>a[i];
            if((a[i]==i)&&(falg)){
                ans+=(n-i);
            }else falg=0;
        }
        ans+=falg;
        cout<<ans%mod<<'\n';
    }
    return 0;
}

Submission Info

Submission Time
Task B - Reverse Permutation
User syq77
Language C++23 (GCC 15.2.0)
Score 400
Code Size 480 Byte
Status AC
Exec Time 99 ms
Memory 7540 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 1
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3432 KiB
01_handmade_00.txt AC 77 ms 3484 KiB
01_handmade_01.txt AC 98 ms 7372 KiB
01_handmade_02.txt AC 98 ms 7412 KiB
01_handmade_03.txt AC 66 ms 3432 KiB
02_random_00.txt AC 99 ms 7452 KiB
02_random_01.txt AC 99 ms 7540 KiB
02_random_02.txt AC 99 ms 7388 KiB
02_random_03.txt AC 99 ms 7492 KiB
02_random_04.txt AC 99 ms 7452 KiB
02_random_05.txt AC 98 ms 7384 KiB
02_random_06.txt AC 98 ms 7452 KiB
02_random_07.txt AC 99 ms 7540 KiB
02_random_08.txt AC 98 ms 7520 KiB
02_random_09.txt AC 98 ms 7492 KiB