#include <bits/stdc++.h>
#include "koala.h"
using namespace std;
const int nmax = 100;
int n;
int b[nmax + 5], r[nmax + 5];
int paux[nmax + 5];
bool sel[nmax + 5];
int p[nmax + 5];
map<pair<int,int>,int> mp;
/*int comp(int pa, int pb)
{
int st = 1;
int dr = n - 2;
int rez = 0;
while(st<=dr)
{
int mij = (st + dr) >> 1;
for(int i=0;i<n;i++)
{
r[i] = 0, b[i] = 0;
}
if(W == 200)
{
for(int i=0;i<n;i++)
{
b[i] = 1;
}
}
int nr = 0;
for(int i=0;i<n && nr < mij;i++)
{
if(i == pa || i == pb)
{
continue;
}
++b[i];
++nr;
}
playRound(b,r);
if(r[pa] <= b[pa] && r[pb] > b[pb])
{
return pb;
}
if(r[pb] <= )
if(r[poz] <= b[poz])
{
dr = mij - 1;
rez = mij;
}
else
{
st = mij + 1;
}
}
return rez;
}
*/
int minValue(int N, int W)
{
n = N;
for(int i=0; i<n; i++)
{
b[i] = 0;
r[i] = 0;
}
b[0] = 1;
playRound(b,r);
for(int i=0; i<n; i++)
{
if(r[i] <= b[i])
{
return i;
}
}
return 0;
}
int maxValue(int N, int W)
{
n = N;
vector<int> c;
for(int i=0; i<n; i++)
{
c.push_back(i);
}
int nr = 0;
while(true)
{
++nr;
while((nr + 1) * (int)(c.size()) <= W)
{
++nr;
}
for(int i=0; i<n; i++)
{
b[i] = 0, r[i] = 0;
}
for(auto it : c)
{
b[it] = nr;
}
playRound(b,r);
vector<int> aux;
for(auto it : c)
{
if(r[it] > b[it])
{
aux.push_back(it);
}
}
c = aux;
if(c.size() == 1)
{
return c.front();
}
}
return 0;
}
bool cmp(int x, int y)
{
if(mp[ {x,y}] == 1)
{
return false;
}
if(mp[ {x,y}] == 2)
{
return true;
}
for(int i=0; i<n; i++)
{
b[i] = r[i] = 0;
}
b[x] = 100;
b[y] = 100;
playRound(b,r);
if(r[x] == 101)
{
mp[ {x,y}] = 1;
mp[ {y,x}] = 2;
return false;
}
mp[ {x,y}] = 2;
mp[ {y,x}] = 1;
return true;
}
int greaterValue(int N, int W)
{
return 0;
}
void allValues(int N, int W, int *P)
{
n = N;
#ifdef home
ifstream f("nr.in");
int a,bb,c,d;
f>>a>>bb>>c>>d;
for(int i=0; i<n; i++)
{
f>>paux[i];
}
#endif // home
if (W == 2*N)
{
for(int i=0; i<n; i++)
{
p[i] = i;
}
sort(p,p+n,cmp);
for(int i=0; i<n; i++)
{
P[p[i]] = i + 1;
}
}
else
{
for(int i=0; i<n; i++)
{
sel[i] = false;
}
for(int val=n; val>=2; val--)
{
vector<int> c;
for(int i=0; i<n; i++)
{
if(sel[i])
{
continue;
}
c.push_back(i);
}
int poz = 0;
int nr = 0;
while(true)
{
++nr;
if(val > 54)
{
while((nr + 1) * (int)(c.size()) + (n - val) <= W)
{
++nr;
}
}
for(int i=0; i<n; i++)
{
b[i] = 0, r[i] = 0;
}
for(auto it : c)
{
b[it] = nr;
}
playRound(b,r);
vector<int> aux;
for(auto it : c)
{
if(r[it] > b[it])
{
aux.push_back(it);
}
}
c = aux;
if(c.size() == 1)
{
poz = c.front();
break;
}
}
P[poz] = val;
sel[poz] = true;
}
for(int i=0; i<n; i++)
{
if(!sel[i])
{
P[i] = 1;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
10 ms |
344 KB |
Output is correct |
3 |
Correct |
10 ms |
344 KB |
Output is correct |
4 |
Correct |
10 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
476 KB |
Output is correct |
2 |
Correct |
31 ms |
344 KB |
Output is correct |
3 |
Correct |
29 ms |
464 KB |
Output is correct |
4 |
Correct |
30 ms |
344 KB |
Output is correct |
5 |
Correct |
30 ms |
456 KB |
Output is correct |
6 |
Incorrect |
32 ms |
596 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
10 ms |
596 KB |
Output is partially correct |
2 |
Partially correct |
12 ms |
452 KB |
Output is partially correct |
3 |
Partially correct |
9 ms |
456 KB |
Output is partially correct |
4 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
5 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
6 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
7 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
8 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
9 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
10 |
Partially correct |
9 ms |
344 KB |
Output is partially correct |
11 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
12 |
Partially correct |
9 ms |
452 KB |
Output is partially correct |
13 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
14 |
Partially correct |
12 ms |
448 KB |
Output is partially correct |
15 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
16 |
Partially correct |
9 ms |
344 KB |
Output is partially correct |
17 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
18 |
Partially correct |
10 ms |
456 KB |
Output is partially correct |
19 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
20 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
21 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
22 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
23 |
Partially correct |
9 ms |
344 KB |
Output is partially correct |
24 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
25 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
26 |
Partially correct |
11 ms |
600 KB |
Output is partially correct |
27 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
28 |
Partially correct |
9 ms |
344 KB |
Output is partially correct |
29 |
Partially correct |
9 ms |
344 KB |
Output is partially correct |
30 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
31 |
Partially correct |
9 ms |
452 KB |
Output is partially correct |
32 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
33 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
34 |
Partially correct |
9 ms |
344 KB |
Output is partially correct |
35 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
36 |
Partially correct |
9 ms |
452 KB |
Output is partially correct |
37 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
38 |
Partially correct |
9 ms |
448 KB |
Output is partially correct |
39 |
Partially correct |
10 ms |
344 KB |
Output is partially correct |
40 |
Partially correct |
9 ms |
452 KB |
Output is partially correct |