Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:dalao太强啦!OrzOrz,打了个multiset膜拜大佬In Reply To:dalao太强啦!OrzOrz Posted by:SSL_XXY at 2018-08-16 08:29:01 #include<algorithm> #include<cstdio> #include<set> #define r(i,a,b) for(register int i=a;i<=b;i++) using namespace std;int t,i,n,x,j; inline int read() { int f=0,d=1;char c; while(c=getchar(),c<48||c>57) if(c=='-') d=-1;f=(f<<3)+(f<<1)+c-48; while(c=getchar(),c>47&&c<58) f=(f<<3)+(f<<1)+c-48; return d*f; } inline void write(register int x) { if(x<0){x=-x;putchar('-');} if(x>9)write(x/10); putchar(x%10+48); return; } signed main() { t=read(); multiset<int>st; r(k,1,t) { st.clear(); i=read();n=read(); write(k);putchar(32);write((n+1)>>1);putchar(10); x=read(); write(x); st.insert(x); for(i=2,j=1;i<=n;i++) { x=read(); st.insert(x); if(i&1) { if(j==10) putchar(10),j=0;else putchar(32); multiset<int>::iterator be=st.begin(); multiset<int>::iterator ed=st.end(); ed--; for(;be!=ed;be++,ed--); printf("%d",*be); j++; } } putchar(10); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator