#include <bits/stdc++.h>
using namespace std;
const int MINN = 1, MAXN = 10, MINM = 1, MAXM = 10, MINV = 1, MAXV = 10;
int n, m;
int main()
{
srand(time(NULL));
for(int iTest = 1; iTest <= 100; iTest++)
{
ofstream inp("vmellip.inp");
n = MINN + rand() % (MAXN - MINN + 1);
m = MINM + rand() % (MAXM - MINM + 1);
inp << n << " " << m << "\n";
for(int i = 1; i <= n; i++)
{
inp << MINV + rand() % (MAXV - MINV + 1) << " " << MINV + rand() % (MAXV - MINV + 1) << " ";
}
inp << "\n";
for(int i = 1; i <= m; i++)
{
int tp = 1 + rand() % 6, l = 1 + rand() % n, h = 1 + rand() % n, v = MINV + rand() % (MAXV - MINV + 1);
if(l > h)
{
swap(l, h);
}
if(tp <= 4)
{
inp << tp << " " << l << " " << h << " " << v << "\n";
}
else
{
inp << tp << " " << l << " " << h << "\n";
}
}
inp << MINV + rand() % (MAXV - MINV + 1) << " " << MINV + rand() % (MAXV - MINV + 1);
inp.close();
system("vmellip.exe");
system("vmellip_trau.exe");
if(system("fc vmellip.out vmellip.ans") != 0)
{
cout << "Test " << iTest << ": WRONG!\n";
return 0;
}
cout << "Test " << iTest << ": CORRECT!\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBNSU5OID0gMSwgTUFYTiA9IDEwLCBNSU5NID0gMSwgTUFYTSA9IDEwLCBNSU5WID0gMSwgTUFYViA9IDEwOwppbnQgbiwgbTsKCmludCBtYWluKCkKewogICAgc3JhbmQodGltZShOVUxMKSk7CiAgICBmb3IoaW50IGlUZXN0ID0gMTsgaVRlc3QgPD0gMTAwOyBpVGVzdCsrKQogICAgewogICAgICAgIG9mc3RyZWFtIGlucCgidm1lbGxpcC5pbnAiKTsKICAgICAgICBuID0gTUlOTiArIHJhbmQoKSAlIChNQVhOIC0gTUlOTiArIDEpOwogICAgICAgIG0gPSBNSU5NICsgcmFuZCgpICUgKE1BWE0gLSBNSU5NICsgMSk7CiAgICAgICAgaW5wIDw8IG4gPDwgIiAiIDw8IG0gPDwgIlxuIjsKICAgICAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47IGkrKykKICAgICAgICB7CiAgICAgICAgICAgIGlucCA8PCBNSU5WICsgcmFuZCgpICUgKE1BWFYgLSBNSU5WICsgMSkgPDwgIiAiIDw8IE1JTlYgKyByYW5kKCkgJSAoTUFYViAtIE1JTlYgKyAxKSA8PCAiICI7CiAgICAgICAgfQogICAgICAgIGlucCA8PCAiXG4iOwogICAgICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbTsgaSsrKQogICAgICAgIHsKICAgICAgICAgICAgaW50IHRwID0gMSArIHJhbmQoKSAlIDYsIGwgPSAxICsgcmFuZCgpICUgbiwgaCA9IDEgKyByYW5kKCkgJSBuLCB2ID0gTUlOViArIHJhbmQoKSAlIChNQVhWIC0gTUlOViArIDEpOwogICAgICAgICAgICBpZihsID4gaCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3dhcChsLCBoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZih0cCA8PSA0KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpbnAgPDwgdHAgPDwgIiAiIDw8IGwgPDwgIiAiIDw8IGggPDwgIiAiIDw8IHYgPDwgIlxuIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlucCA8PCB0cCA8PCAiICIgPDwgbCA8PCAiICIgPDwgaCA8PCAiXG4iOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlucCA8PCBNSU5WICsgcmFuZCgpICUgKE1BWFYgLSBNSU5WICsgMSkgPDwgIiAiIDw8IE1JTlYgKyByYW5kKCkgJSAoTUFYViAtIE1JTlYgKyAxKTsKICAgICAgICBpbnAuY2xvc2UoKTsKICAgICAgICBzeXN0ZW0oInZtZWxsaXAuZXhlIik7CiAgICAgICAgc3lzdGVtKCJ2bWVsbGlwX3RyYXUuZXhlIik7CiAgICAgICAgaWYoc3lzdGVtKCJmYyB2bWVsbGlwLm91dCB2bWVsbGlwLmFucyIpICE9IDApCiAgICAgICAgewogICAgICAgICAgICBjb3V0IDw8ICJUZXN0ICIgPDwgaVRlc3QgPDwgIjogV1JPTkchXG4iOwogICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICAgICAgY291dCA8PCAiVGVzdCAiIDw8IGlUZXN0IDw8ICI6IENPUlJFQ1QhXG4iOwogICAgfQogICAgcmV0dXJuIDA7Cn0K