Submission #137924

# Submission time Handle Problem Language Result Execution time Memory
137924 2019-07-28T14:13:23 Z MohamedAhmed04 Minerals (JOI19_minerals) C++14
0 / 100
1000 ms 376 KB
#include <bits/stdc++.h>
#include "minerals.h"
//#include "grader.cpp"

using namespace std ;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rnd(s ,e) uniform_int_distribution<int>(s, e)(rng)

int found[30005] , notme[30005];

void Solve(int N) 
{
   if(N <= 100)
   {
	   for(int i = 1 ; i <= N*2 ; ++i)
	   {
	   	   Query(i) ;
	   	   for(int j = i+1 ; j <= N*2 ; ++j)
	   	   {
	   	   	   int x = Query(j) ;
	   	   	   if(x == 1)
	   	   	   {
	   	   	   		Query(j) ;
	   	   	   		Answer(i , j) ;
	   	   	   		break ;
	   	   	   }
		   	   Query(j) ;
	   	   }
	   	   Query(i) ;
	   }
    }
   for(int i = N+1 ; i <= N*2 ; ++i)
   	found[i] = 0 , notme[i] = 0;
   for(int i = 1 ; i <= N ; ++i)
   {
   	   Query(i) ;
   	   while(true)
   	   {
   	   	  int x = rnd(N+1 , N*2) ;
   	   	  if(found[x] || notme[x] == i)
   	   	  	continue ;
   	   	  int a = Query(x) ;
   	   	  Query(x) ;
   	   	  if(a == 1)
   	   	  {
   	   	  	found[x] = 1 ;
   	   	  	break ;
   	   	  }
   	   	  notme[x] = i ;
   	   }
   	   Query(i) ;
   }
   return ;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 372 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -