Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- bool M[5001][5001];
- int n,m;
- int main(){
- cin>>n>>m;
- for (int i=0;i<m;i++){
- int a,b;
- cin>>a>>b;
- a--;b--;
- M[a][b]=1;
- M[b][a]=1;
- }
- int answer=n+(n*(n-1))/2-m;
- int answer_three=0; int answer_four=0;
- cout<<"THREE ANSWER:"<<endl;
- for (int i=0;i<n;i++)
- for (int j=i+1;j<n;j++)
- for (int z=j+1;z<n;z++){
- if (!(M[i][j] || M[i][z] || M[j][z])){
- answer++,answer_three++;
- cout<<i<<" "<<j<<" "<<z<<endl;
- }
- }
- cout<<"FOURTH ANSWER::"<<endl;
- for (int i=0;i<n;i++)
- for (int j=i+1;j<n;j++)
- for (int z=j+1;z<n;z++)
- for (int u=z+1;u<n;u++){
- if (!(M[i][j] || M[i][z] || M[i][u] || M[j][z] || M[j][u] || M[z][u])){
- answer++,answer_four++;
- cout<<i<<" "<<j<<" "<<z<<" "<<u<<endl;
- }
- }
- cout<<"REAL ANSWER:"<<endl;
- cout<<answer_three<<" "<<answer_four<<endl;
- cout<<answer<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment