#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
long long INF=numeric_limits<long long>::max();
int n,q;
int p[1011],visit[1011];
int adj[55][55];
vector < pair < int, pii> > pos[55];
/*
int Flip(int I, int J)
{
//cout << I << " " << J << endl;
int x;
cin >> x;
return x;
}
void Answer(int I, int J, int X)
{
cout << I << " " << J << " " << X << endl;
}
*/
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
//freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
int t; cin >> t;
if(t==1)
{
cin >> n >> q;
n*=2;
memset(p,0,sizeof(p));
for(int i = 1; i <= n; i++)
{
for(int j = i+1; j <= n; j++)
{
int x = Flip(i,j);
adj[i-1][j-1] = x;
adj[j-1][i-1] = x;
}
}
for(int i = 0; i < n; i++)
{
for(int j = i+1; j < n; j++)
{
for(int k = j+1; k < n; k++)
{
if(adj[i][j]==adj[i][k]&&adj[i][j]==adj[j][k])
{
int curr = adj[i][j];
pos[curr].pb(mp(i,mp(j,k)));
//cout << adj[i][j] << " " << i << " " << j << " " << k << endl;
}
}
}
}
/*
cout << "***" << endl;
for(int i = 0; i <= 50; i++)
{
if(pos[i].empty())continue;
cout << i << endl;
for(int j = 0; j < pos[i].size(); j++)
{
cout << pos[i][j].fi << " " << pos[i][j].se.fi << " " << pos[i][j].se.se << endl;
}
cout << endl;
}
cout << "***" << endl;
*/
int pos1(-1),pos2(-1);
for(int i = 0; i <= 50; i++)
{
pos1 = -1;
if(pos[i].empty())continue;
int vis[n];
memset(vis,0,sizeof(vis));
//cout << i << " ";
for(int j = 0; j < 2; j++)
{
//cout << pos[i][j].fi << " " << pos[i][j].se.fi << " " << pos[i][j].se.se << " ";
if(!vis[pos[i][j].fi])
{
vis[pos[i][j].fi] = 1;
}
else
{
if(pos1==-1)pos1 = pos[i][j].fi;
else pos2 = pos[i][j].fi;
}
if(!vis[pos[i][j].se.fi])
{
vis[pos[i][j].se.fi] = 1;
}
else
{
if(pos1==-1)pos1 = pos[i][j].se.fi;
else pos2 = pos[i][j].se.fi;
}
if(!vis[pos[i][j].se.se])
{
vis[pos[i][j].se.se] = 1;
}
else
{
if(pos1==-1)pos1 = pos[i][j].se.se;
else pos2 = pos[i][j].se.se;
}
}
//cout << endl;
//cout << " ~ " << pos1 << " " << pos2 << endl;
Answer(pos1,pos2,i);
visit[pos1] = 1;
visit[pos2] = 1;
}
pos1 = -1, pos2 = -1;
for(int i = 0; i < n; i++)
{
if(visit[i]==0)
{
if(pos1==-1)pos1 = i;
else
{
pos2 = i;
break;
}
}
}
Answer(pos1,pos2,n/2-1);
//for(int i = 0; i < n; i++)cout << p[i] << " " ;
//cout << endl;
}
}
Compilation message
memory2.cpp: In function 'int main()':
memory2.cpp:64:13: error: 'Flip' was not declared in this scope
int x = Flip(i,j);
^~~~
memory2.cpp:64:13: note: suggested alternative: 'pli'
int x = Flip(i,j);
^~~~
pli
memory2.cpp:145:4: error: 'Answer' was not declared in this scope
Answer(pos1,pos2,i);
^~~~~~
memory2.cpp:162:3: error: 'Answer' was not declared in this scope
Answer(pos1,pos2,n/2-1);
^~~~~~