#include #include using namespace std; const int KOSZULKA = 0; const int SPAKOWANY = -1; long strony=0; vector stos; //long stos[1000000]; long licznik =0; long wynik=0; long error=1; long temp, temp2; long j,k; int main(void) { cin >> strony; stos.resize(strony*2); for(int i=0; i<(2*strony);i++) cin >> stos[i]; while (error > 0) { error=0; for(j=0;j KOSZULKA && stos[j+1] > KOSZULKA)) { error++; wynik++; temp = stos[j]; stos[j] = stos[j+1]; stos[j+1] =temp; } else { stos[j] = SPAKOWANY; stos[j+1] = SPAKOWANY; } if(stos[j] == SPAKOWANY && stos[j+1] == SPAKOWANY) { temp = stos[j]; temp2 = stos[j+1]; for(k=j+2; k0) { error=0; cout << "petla sie wykonala iles razy" << endl; for (j=0;jKOSZULKA && stos[j+1]>KOSZULKA))&&(stos[j]!=SPAKOWANY && stos[j+1]!=SPAKOWANY)) { error++; wynik++; temp = stos[j]; stos[j] = stos[j+1]; stos[j+1] =temp; } else { stos[j] = SPAKOWANY; stos[j=1] = SPAKOWANY; } } } */ cout << wynik <