QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102191 | #6354. 4 | zhouhuanyi | WA | 3ms | 7560kb | C++11 | 905b | 2023-05-02 15:36:29 | 2023-05-02 15:36:33 |
Judging History
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'