QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#659497#9477. Topological Sortucup-team3659#WA 1ms3532kbC++20566b2024-10-19 20:26:082024-10-19 20:26:09

Judging History

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

  • [2024-10-19 20:26:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3532kb
  • [2024-10-19 20:26:08]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[500005];
const int mod=998244353,mid=998244352;
int pw(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
int n;
vector<int> v;
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
    int ans=n*(n-1)/2%mid;
    int k=n+1;
    for(int i=1;i<=n;i++)
        if(a[i]<k)
            k=a[i];
        else
            (ans+=mid-1)%=mid;
    cout<<pw(2,ans);
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3532kb

input:

3
1 3 2

output:

2

result:

wrong answer 1st words differ - expected: '4', found: '2'