FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » 500. Turbo Sort
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: 500. Turbo Sort [message #172614 is a reply to message #172608] Tue, 22 February 2011 05:26 Go to previous messageGo to previous message
n00m is currently offline  n00m
Messages: 25
Registered: February 2011
Karma:
Junior Member
This took 1.82s (g++4.0.0-8) and was accepted of course.
Seems it's not for PHP


#include <stdio.h>
#include <ctype.h>

int read_ui() {
int m = 0;
char c;
while (!isdigit(c = getchar()));
while (isdigit(c)) {
m = m * 10 + (c - '0');
c = getchar();
}
return m;
}

int a[1000001], n, i, j;

int main() {
n = read_ui();
for (i = 0; i < n; ++i) {
++a[read_ui()];
}
for (i = 0; i < 1000001; ++i) {
for (j = 0; j < a[i]; ++j) {
printf("%d\n", i);
}
}
return 0;
}
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to read/to download attachment on an URI?
Next Topic: Proxy to open blocked sites
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 08:34:58 GMT 2024

Total time taken to generate the page: 0.04162 seconds