QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102191#6354. 4zhouhuanyiWA 3ms7560kbC++11905b2023-05-02 15:36:292023-05-02 15:36:33

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-02 15:36:33]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:7560kb
  • [2023-05-02 15:36:29]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<bitset>
#define N 100000
#define M 512
using namespace std;
int read()
{
    char c=0;
    int sum=0;
    while (c<'0'||c>'9') c=getchar();
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum;
}
struct reads
{
    int num,data;
};
int n,m,X[N+1],Y[N+1];
long long ans;
bitset<M+1>B[N+1];
bitset<M+1>S[N+1];
bitset<M+1>dp[N+1];
int main()
{
    n=read(),m=read();
    for (int i=1;i<=m;++i) X[i]=read(),Y[i]=read();
    for (int i=1;i<=m;i+=M)
    {
	for (int j=1;j<=n;++j) S[j].reset(),B[j].reset(),dp[j].reset();
	for (int j=i;j<=min(i+M-1,m);++j) S[X[j]][j-i]=S[Y[j]][j-i]=1;
	for (int j=1;j<=m;++j) dp[X[j]]|=(B[X[j]]&S[Y[j]]),dp[Y[j]]|=(B[Y[j]]&S[X[j]]),B[X[j]]|=S[Y[j]],B[Y[j]]|=S[X[j]];
	for (int j=i+1;j<=m;++j) ans+=(dp[X[j]]&dp[Y[j]]).count();
    }
    printf("%lld\n",ans/3);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 7560kb

input:

5 9
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5

output:

3

result:

wrong answer 1st numbers differ - expected: '2', found: '3'