Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int n,m;
- int graf[1001];//tu ilosc czerwonych krawedzi dla kazdego wierzcholka
- int p,k;
- long long rozne;
- long long all;
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin>>n>>m;
- all = n * (n-1) * (n-2) / 6;
- for(int i = 1; i <= m; i++)
- {
- cin>>p>>k;
- graf[p]++;
- graf[k]++;
- }
- for(int i = 1; i <= n; i++)
- {
- rozne += (graf[i] * (n - 1 - graf[i]) / 2 ); // czerwone * czarne / 2;
- }
- cout<<all - rozne;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement