Pagini recente » Cod sursa (job #531656) | Cod sursa (job #268697) | Cod sursa (job #3281438) | Cod sursa (job #873839) | Cod sursa (job #3285166)
#include <bits/stdc++.h>
using namespace std;
ifstream fcin("curcubeu.in");
ofstream fcout("curcubeu.out");
const int N = 1e6 + 5;
int n, a, b, c, mx, mn;
struct elem
{
int c, poz, i;
bool operator <(const elem &e)const
{
if (e.poz != poz)
return e.poz < poz;
return e.i < i;
}
} v[N], f[N];
/**
1 2 3 - 1
2 4 1 - 2
1 2 3 - 3
3 4 2 - 4
*/
int main()
{
fcin >> n >> a >> b >> c;
mn = min(a, b);
mx = max(a, b);
v[1] = {c, mn, 1};
f[1] = {c, mx + 1, 1};
for (int i = 2; i < n; i++)
{
a = (1ll * a * i) % n;
b = (1ll * b * i) % n;
c = (1ll * c * i) % n;
cout << a << ' ' << b << ' ' << c << endl;
mn = min(a, b);
mx = max(a, b);
v[i] = {c, mn, i};
f[i] = {c, mx + 1, i};
}
sort(v + 1, v + n + 1);
sort(f + 1, f + n + 1);
// stack<pair<int, int>> s1, s2;
// for (int i = 1, j1 = 1, j2 = 1; i < n; i++)
// {
// for (; j1 < n && v[j1].poz == i; j1++)
// s1.push()
// }
return 0;
}