QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#669303#9477. Topological Sortbulijiojiodibuliduo#WA 0ms3816kbC++17952b2024-10-23 18:03:272024-10-23 18:03:30

Judging History

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

  • [2024-10-23 18:03:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-10-23 18:03:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=201000;
int n,pmx,a[N];
ll cnt;
int main() {
	scanf("%d",&n);
	int pmx=0;
	rep(i,1,n+1) {
		scanf("%d",&a[i]);
		cnt+=i-1;
		if (a[i]<pmx) {
			cnt--;
		} else {
			pmx=a[i];
		}
	}
	printf("%lld\n",powmod(2,cnt));
}

詳細信息

Test #1:

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

input:

3
1 3 2

output:

4

result:

ok "4"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

5
1 2 3 4 5

output:

1024

result:

ok "1024"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

6
4 2 1 5 6 3

output:

4096

result:

ok "4096"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3780kb

input:

492
397 486 227 395 58 452 172 216 130 181 268 482 85 209 365 104 373 90 260 326 252 96 267 106 102 398 441 41 292 314 12 78 242 353 153 424 179 86 299 228 54 390 73 465 396 349 4 10 451 99 342 250 391 6 323 197 159 47 136 473 392 77 125 362 418 255 291 13 238 339 8 28 413 121 384 157 152 23 221 305...

output:

390557336

result:

wrong answer 1st words differ - expected: '73428942', found: '390557336'