QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#370567 | #6354. 4 | Kevin5307 | WA | 0ms | 4024kb | C++20 | 961b | 2024-03-29 11:29:28 | 2024-03-29 11:29:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
bitset<500> bs[100100];
int n,m;
int u[100100],v[100100];
int ind[100100],deg[100100];
vector<int> G[100100];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(int i=1;i<=m;i++)
{
cin>>u[i]>>v[i];
deg[u[i]]++;
deg[v[i]]++;
}
for(int i=1;i<=m;i++)
if(pii(deg[u[i]],u[i])<pii(deg[v[i]],v[i]))
G[u[i]].push_back(v[i]);
else
G[v[i]].push_back(u[i]);
memset(ind,-1,sizeof(ind));
ll ans=0;
for(int i=1;i<=n;i++)
{
for(int j=0;j<G[i].size();j++)
ind[G[i][j]]=j;
for(auto j:G[i])
{
bs[j].reset();
for(auto k:G[j])
if(~ind[k])
bs[j].set(ind[k]);
}
for(auto j:G[i])
for(auto k:G[j])
if(~ind[k])
ans+=(bs[j]&bs[k]).count();
for(int j=0;j<G[i].size();j++)
ind[G[i][j]]=-1;
}
cout<<1<<" "<<1<<" "<<1<<" "<<ans<<'\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4024kb
input:
5 9 1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5
output:
1 1 1 2
result:
wrong answer 1st numbers differ - expected: '2', found: '1'