QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#91995#905. 三元环枚举Minion#WA 8ms6408kbC++231.0kb2023-03-30 07:36:342023-03-30 07:36:37

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-30 07:36:37]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:6408kb
  • [2023-03-30 07:36:34]
  • 提交

answer

#include<cstdio>
#define fo(i,x,y) for(int i = x;i <= y;++i)
#define fd(i,x,y) for(int i = x;i >= y;--i)
#define _is 1048576 * 4
#define gc() ib[++bi]
#define p 998244353
using namespace std;
char ib[_is];int bi = -1;
int rd()
{
	int x = 0;char ch = gc();
	while(ch < 48 || ch > 57) ch = gc();
	while(ch >= 48 && ch <= 57) x = x * 10 + ch - 48,ch = gc();
	return x;
}
int n,m,a[100010],e[100010][2],lst[100010],tot,x[100010],y[100010],d[100010];
bool bz[100010];
void add(int x,int y) {e[++tot][0] = y,e[tot][1] = lst[x],lst[x] = tot;}
int main()
{
	fread(ib,1,_is,stdin);
	n = rd(),m = rd();
	fo(i,1,n) a[i] = rd();
	fo(i,1,m) x[i] = rd() + 1,y[i] = rd() + 1,++d[x[i]],++d[y[i]];
	fo(i,1,m) d[x[i]] < d[y[i]] ? add(x[i],y[i]) : add(y[i],x[i]);
	int ans = 0;
	fo(i,1,n)
	{
		for(int j = lst[i];j;j = e[j][1]) bz[e[j][0]] = 1;
		for(int j = lst[i];j;j = e[j][1]) for(int k = lst[e[j][0]];k;k = e[k][1]) if(bz[e[k][0]]) ans = (ans + 1ll * a[i] * a[e[j][0]] % p * a[e[k][0]]) % p;
	}
	printf("%d\n",ans);
}

詳細信息

Test #1:

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

input:

4 5
1 2 3 4
0 3
2 0
2 1
2 3
1 3

output:

36

result:

ok "36"

Test #2:

score: -100
Wrong Answer
time: 8ms
memory: 6408kb

input:

17707 77101
528756313 434883274 318065816 264440383 659789617 608119380 648104885 725454492 696703871 543030428 663661240 890791532 108201616 428505484 322953840 119811886 691103780 306647414 549862302 176916719 909058872 455464665 307270851 584469329 722629343 875317523 629938577 244419357 78121457...

output:

175521741

result:

wrong answer 1st words differ - expected: '397965084', found: '175521741'