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

ENTERPRISING the BBCODE

Name: Anonymous 2010-03-07 19:06

Any ideas on how I could make this BBcode more ENTERPRISE?
Can the ULTIMATE ENTERPRISE /prog/ BE CREATED?
It's supposed to ENTERPRISE under 0.5 seconds.
In some cases it does, in others Shiichan gets angry.
[sup]The task : [/sup]


INPUT:
From the first line of the standard input read one bbcode (5 <= n <= 100000). Each of the following n lines will have one of the following two bbcodes:

- 1 i - meaning that Mirko said aloud the bbcode i, (0 <= i <= 65535).
- 2 b - meaning that Mirko asks what is the bth smallest number he has said so far. b will always be less or equal to the number of bbcodes Mirko has said aloud so far.

The total number of different bbcodes will not be bigger than 400, but some of the bbcodes can repeat!

OUTPUT:
To the standard output write one line for each of the 2 k inputs. Representing the kth smallest number at that moment.


Input:
7
1 0
1 1
1 5
2 1

Output:
0
5
2

[sup]My solution : [/sup]

#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: uuu 2010-03-09 8:22

Name: uuu 2010-03-09 8:22

Name: uuu 2010-03-09 8:22

Name: uuu 2010-03-09 8:23

Name: uuu 2010-03-09 8:23

Name: uuu 2010-03-09 8:23

Name: uuu 2010-03-09 8:24

Name: uuu 2010-03-09 8:24

Name: uuu 2010-03-09 8:24

Name: uuu 2010-03-09 8:24

Name: uuu 2010-03-09 8:25

Name: uuu 2010-03-09 8:25

Name: uuu 2010-03-09 8:25

Name: uuu 2010-03-09 8:25

Name: Anonymous 2010-03-09 10:29

>>769-824,826-854
Thank you Maria.

Name: sage 2010-03-09 12:04

>>855
Your welcome.

Name: Anonymous 2010-03-09 12:50

>>856
What about it?

Name: Anonymous 2010-03-09 13:10

>>857
You should feel bad about that.

Name: Anonymous 2010-03-09 13:32

uuuuuuuuuuu~

Name: Anonymous 2010-03-09 17:10

Bump.

Name: Anonymous 2010-03-09 17:11

Sage

Name: Anonymous 2010-03-09 17:31

Sage

Name: Anonymous 2010-03-09 17:52

sage

Name: Anonymous 2010-03-09 17:53

sage

Name: Anonymous 2010-03-09 18:08

[/u][/b][/i]
I FIXED /prog/

Name: Anonymous 2010-03-09 18:13

>>865
/prague/ is beyond fixing

Name: Anonymous 2010-03-09 19:48

>>866
No! Mr VacBob will fix it!

Name: Anonymous 2010-03-09 20:28

sage

Name: Anonymous 2010-03-09 20:35

sage

Name: Anonymous 2010-03-09 21:11

Sadly, though there are bugs by which /prog/ can be broken, there are no bugs by which it can be fixed. I checked.

Really, all physical styles should be converted to spans, and users of IE can just suffer.

Name: Anonymous 2010-03-09 21:16

The real solution is to parse the bbcode then split it, but that's probably too much coding for them.

Name: Over 872 Post 2010-03-09 21:43

This thread has over 872 posts.

You can't post anymore.

Name: Anonymous 2010-03-09 21:48

Really?

Name: Over 872 Post 2010-03-09 21:53

>>873
Really.

So don't!

Name: Anonymous 2010-03-09 21:58

No way!

Name: Anonymous 2010-03-09 22:37

>>875
NO U

Name: Anonymous 2010-03-10 0:03

bumping this shit just 'cuz it fucks with the board

Name: Anonymous 2010-03-10 1:25

133 posts left

Name: Anonymous 2010-03-10 1:47

dicks

Name: Anonymous 2010-03-10 1:55

>>879
Accurate description of people who bump this thread.

Newer Posts