#include"lokahia.h"
#include<vector>
#include<ctime>
#include<algorithm>
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf=1e18;
int C[205];
int FindBase(int N)
{
if(N==1)
return 0;
for(int i=0;i<500;i++)
srand(time(0));
for(int i=0;i<601-N;i++)
{
int n=rand()%N;
int j=n;
while(j==n)
j=rand()%N;
int t=CollectRelics(n,j);
if(t!=-1)
C[t]++;
}
int m,M=-1;
for(int i=0;i<N;i++)
if(C[i]>M)
m=i,M=C[i];
int c=0;
for(int i=0;i<N;i++)
{
if(i==m)
c++;
else
c+=CollectRelics(i,m)!=-1;
}
if(c<N/2)
return-1;
return m;
}
Compilation message
lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:31:6: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
int m,M=-1;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Correct : C = 0 |
2 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |
3 |
Partially correct |
7 ms |
640 KB |
Partially correct : C = 600 |
4 |
Partially correct |
7 ms |
640 KB |
Partially correct : C = 600 |
5 |
Partially correct |
6 ms |
512 KB |
Partially correct : C = 600 |
6 |
Partially correct |
8 ms |
512 KB |
Partially correct : C = 600 |
7 |
Partially correct |
8 ms |
640 KB |
Partially correct : C = 600 |
8 |
Partially correct |
8 ms |
640 KB |
Partially correct : C = 600 |
9 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |
10 |
Incorrect |
8 ms |
640 KB |
Wrong |
11 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |
12 |
Partially correct |
7 ms |
640 KB |
Partially correct : C = 600 |
13 |
Partially correct |
7 ms |
640 KB |
Partially correct : C = 600 |
14 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |
15 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |
16 |
Incorrect |
7 ms |
512 KB |
Wrong |
17 |
Partially correct |
8 ms |
640 KB |
Partially correct : C = 600 |
18 |
Partially correct |
8 ms |
640 KB |
Partially correct : C = 600 |
19 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |
20 |
Partially correct |
8 ms |
640 KB |
Partially correct : C = 600 |
21 |
Partially correct |
7 ms |
508 KB |
Partially correct : C = 600 |
22 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |
23 |
Incorrect |
8 ms |
512 KB |
Wrong |
24 |
Partially correct |
7 ms |
640 KB |
Partially correct : C = 600 |
25 |
Partially correct |
7 ms |
640 KB |
Partially correct : C = 600 |
26 |
Incorrect |
7 ms |
640 KB |
Wrong |
27 |
Partially correct |
7 ms |
512 KB |
Partially correct : C = 600 |