Skip to content

Instantly share code, notes, and snippets.

@robertseaton
Created March 20, 2012 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertseaton/2140485 to your computer and use it in GitHub Desktop.
Save robertseaton/2140485 to your computer and use it in GitHub Desktop.
computers are fast
/* when in doubt,
use brute force */
int l, k;
long long inversions = 0;
for (l = 0; l < 100000; l++)
for (k = l; k < 100000; k++)
if (j[l] > j[k])
inversions++;
printf("answer %lld\n", inversions);
@robertseaton
Copy link
Author

4.76s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment