QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#641530 | #905. 三元环枚举 | Zhou_JK | WA | 1ms | 3660kb | C++23 | 878b | 2024-10-14 20:57:32 | 2024-10-14 20:57:32 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
constexpr int N=100005,M=100005;
int n,m;
int u[M],v[M];
int deg[N];
vector<int>G[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
cin>>n>>m;
fill(deg+1,deg+n+1,0);
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(deg[u[i]]>deg[v[i]]||(deg[u[i]]==deg[v[i]]&&u[i]>v[i])) swap(u[i],v[i]);
G[u[i]].emplace_back(v[i]);
}
int ans=0;
for(int u=1;u<=n;u++)
{
static bool vis[N];
for(int v:G[u])
vis[v]=true;
for(int v:G[u])
for(int w:G[v])
if(vis[w]) ans++;
for(int v:G[u])
vis[v]=false;
}
cout<<ans;
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3660kb
input:
4 5 1 2 3 4 0 3 2 0 2 1 2 3 1 3
output:
0
result:
wrong answer 1st words differ - expected: '36', found: '0'