Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What about my new code?

Name: Anonymous 2010-03-02 5:40

Input:
7
1 0
1 1
1 5
2 1
2 3
1 2
2 3

Output:
0
5
2

My solution :

#include <stdio.h>
int main(){
    unsigned short int * a;
        unsigned int n,j,x,y;
    int m=-1;
    scanf("%u",&n);
    a=new unsigned short int[n];
    while (n>0){
        n=n-1;
        scanf("%u %u",&x,&y);
        if (x==1){
            m=m+1;
            j=m;
            a[j]=y;
            while((j>0)&&(a[j]<a[j-1])){
                y=a[j-1];
                a[j-1]=a[j];
                a[j]=y;
                j=j-1;
            }

        }
        else printf("%u\n",a[y-1]);
    }
    delete [] a;
    return 0;
}

Name: Anonymous 2010-03-04 18:04

>>1
Not only did you miss you're original thread, but you wound up on entirely the wrong board.  You are a complete failure.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List