Pagini recente » Cod sursa (job #2971094) | Cod sursa (job #1226241) | Cod sursa (job #933795) | Cod sursa (job #682804) | Cod sursa (job #2243482)
#include <bits/stdc++.h>
using namespace std;
const int b = 32000;
struct parser
{
char *B,*E,*p;
parser()
{
freopen("algsort.in","r",stdin);
freopen("algsort.out","w",stdout);
B = new char [ b + 10 ];
E = B + b;
LoadBuffer();
}
parser &operator>>(int &x)
{
while( *p < '0' || '9' < *p)if(++p==E)LoadBuffer();
x=0;
while( '0' <= *p && *p <= '9')
{
x = 10*x + *p - '0';
if(++p==E)LoadBuffer();
}
return *this;
}
void operator>>(vector<int> &a)
{
int n,x;
*this >> n;
for(;n;n--)
{
*this >> x;
a.push_back(x);
}
sort(a.begin(),a.end());
}
void operator<<(vector<int> a)
{
for(auto it:a)
printf("%d ",it);
}
void LoadBuffer()
{
p=B;
memset(B,0,b);
fread(B,1,b,stdin);
}
};
vector<int> v;
int main()
{
parser f;
f>>v;
f<<v;
return 0;
}