fork download
#include 
#include 
#include 
#include 
#include 
#include 
#include 

typedef unsigned value;
typedef unsigned index;

#ifdef _DEBUG
const index datacount = 10000;
const index lookupcount = 10000;
#else
const index datacount = 10000000;
const index lookupcount = 100000;
#endif

int main() {
	std::vector a(datacount); //amount of data
	for(index i=0; i findme(lookupcount); //number of finds to do
	for(index i=0; i> sorted(a.size());  //reverse lookup vector
		for(index i=0; i(a[i], i);
		std::sort(sorted.begin(), sorted.end()); //that is sorted
		for(index i=0; i(findme[i], 0));
		    result += iter->second; //add it's index
		}
		clock_t end = clock();
		std::cout << " found " << result << " in " << (end-begin) << " ticks.\n";
	}

	{
		std::cout << "unordered_map ";
		index result = 0;
		clock_t begin = clock();
		std::unordered_map lookup(a.size());  //reverse lookup hash
		for(index i=0; i lookup;   //reverse lookup map
		for(index i=0; i
				
				
				
				
				
				
			
Time limit exceeded #stdin #stdout 5s 42296KB
stdin
Standard input is empty
stdout

Standard output is empty