#include #include using namespace std; bool vizsgal( vector &k, unsigned int &b, unsigned int &e) { int elofordulas = 0; unsigned int i = b-1; //cout << b << " " << e << endl; while (i < e && elofordulas == 0) { unsigned int j=i+1; while (j < e && elofordulas < 1) { if (k[i] == k[j]) elofordulas++; if (elofordulas == 1) cout << k[i] << endl; j++; } i++; } if (elofordulas == 1) return true; return false; } int app(istream &f) { unsigned int M; unsigned int Q; unsigned int b, e; vector k; vector u; string temp; for (;;) { f >> M >> Q; if (M == 0 && Q == 0) return 0; for (unsigned int i=0;i> e; k.push_back(e); } for (unsigned int i=0;i> b >> e; if (vizsgal(k,b,e) == false) { cout << "OK" << endl; } } cout << endl; getline(f,temp); k = u; } return 0; } int main() { app(cin); return 0; }