Cod sursa(job #2163083)
| Utilizator | Data | 12 martie 2018 16:40:38 | |
|---|---|---|---|
| Problema | Tablete | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <fstream>
#include <algorithm>
#define x first
#define y second
using namespace std;
ifstream fin("wall.in");
ofstream fout("wall.out");
const int d=100001;
pair < int, int > a[d];
int n,m,t,cnt;
int main()
{
fin>>n>>m;
for (int i=1; i<=n; ++i)
{
fin>>t;
if (t<m)
++cnt;
a[i]= {t,i};
}
sort (a+1, a+1+n);
fout<<cnt<<"\n";
for(int i=n;i>=1;--i)
if ((n-i+1)%2==0)
fout<<a[i].y<<" "<<1<<"\n";
else
fout<<a[i].y<<" "<<m<< "\n";
}
