Cod sursa(job #2288594)

Utilizator rebeca98Tataru Rebeca rebeca98 Data 23 noiembrie 2018 17:50:31
Problema Stergeri Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <fstream>
using namespace std;


int main()
{
 ifstream f("stergeri.in") ;
 ofstream g("stergeri.out");
 int i, n, m, k, x, y, v[100000],j;
 f>>n>>m>>k;
 for(i=1;i<=n;i++)
 {
     v[i]=i;
 }

 for(i=1;i<=m;i++)
 {
     f>>x>>y;

int j;
for(j=x;j<=n;j++)
{
    v[j]=v[j+(y-x)+1];
}



    for(j=1;j<=n;j++)
        cout<<v[j]<<" ";

    cout<<endl;
 }
cout<<v[k]<<" "<<n;
g<<v[k];
    return 0;
}