Submission #137926

# Submission time Handle Problem Language Result Execution time Memory
137926 2019-07-28T14:14:44 Z MohamedAhmed04 Minerals (JOI19_minerals) C++14
6 / 100
63 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) ;
	   }
	   return ;
    }
   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 ;
   	   	  	Answer(i , x) ;
   	   	  	break ;
   	   	  }
   	   	  notme[x] = i ;
   	   }
   	   Query(i) ;
   }
   return ;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 372 KB Output is correct
2 Incorrect 63 ms 376 KB Wrong Answer [2]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 50 ms 372 KB Output is correct
6 Incorrect 63 ms 376 KB Wrong Answer [2]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 50 ms 372 KB Output is correct
6 Incorrect 63 ms 376 KB Wrong Answer [2]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 50 ms 372 KB Output is correct
6 Incorrect 63 ms 376 KB Wrong Answer [2]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 50 ms 372 KB Output is correct
6 Incorrect 63 ms 376 KB Wrong Answer [2]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 50 ms 372 KB Output is correct
6 Incorrect 63 ms 376 KB Wrong Answer [2]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 50 ms 372 KB Output is correct
6 Incorrect 63 ms 376 KB Wrong Answer [2]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 50 ms 372 KB Output is correct
6 Incorrect 63 ms 376 KB Wrong Answer [2]
7 Halted 0 ms 0 KB -