#include using namespace std; int pocetDni; int stary[30]; int novy[30]; //vrati index hladaneho prvku int najdiMale(int prvok){ for (int i = 1; i < 30; i++){ if (stary[i] == prvok) return i; } return 0; } void vypisStare(){ for (int i=0; i < pocetDni; i++){ cout << stary[i] << " "; } cout << endl; } void otocPole(int index){ for (int i = 0; i <= (index/2); i++){ int tmp = stary[i]; stary[i] = stary[index-i]; stary[index-i] = tmp; } //vypisStare(); cout << (index+1) << " "; } int main (int argc, char* argv[]){ cin >> pocetDni; while (pocetDni){ int male; for (int i = 0; i < pocetDni; i++){ cin >> stary[i]; } for (int i = 0; i < pocetDni; i++){ cin >> novy[i]; } bool otocene = false; for (int i = (pocetDni-1); i>0; i--){ if (stary[i] != novy[i]) { //cout << "stary = " << stary[i] << " novy = " << novy[i] << endl; otocene = true; if (stary[0] != novy[i]) { male = najdiMale(novy[i]); otocPole(male); //cout << "male = " << male << endl; } otocPole(i); } } if (otocene) cout << endl; else cout << "0" << endl; cin >> pocetDni; } return 0; }