#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int N = 2e5 + 10;
int n , m;
vector <int> C , X , Y , adj[N];
int Solve(vector <int> vec)
{
if(vec.size() == 1)
return vec[0];
X.push_back(0);
Y.push_back(0);
int now = X.size();
vector <int> v[2];
if(vec.size() % 2 == 1)
{
vec.push_back(-now);
swap(vec[vec.size() - 1] , vec[vec.size() - 2]);
}
for(int i = 0 ; i < vec.size() ; i++)
v[i % 2].push_back(vec[i]);
int tmp = Solve(v[0]);
X[now - 1] = tmp;
tmp = Solve(v[1]);
Y[now - 1] = tmp;
return -1 * now;
}
void Build(int v)
{
if(adj[v].empty())
{
C[v] = 0;
return;
}
int tmp = Solve(adj[v]);
C[v] = tmp;
}
void create_circuit(int mm , vector <int> A)
{
n = A.size();
m = mm;
C.resize(m + 1);
adj[0].push_back(A[0]);
for(int i = 0 ; i + 1 < n ; i++)
adj[A[i]].push_back(A[i + 1]);
adj[A.back()].push_back(0);
for(int i = 0 ; i <= m ; i++)
{
//cout << i << " : " << endl;
Build(i);
}
answer(C , X , Y);
}
Compilation message
doll.cpp: In function 'int Solve(std::vector<int>)':
doll.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(int i = 0 ; i < vec.size() ; i++)
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
17 ms |
9304 KB |
Output is correct |
3 |
Correct |
14 ms |
8908 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
7 ms |
6236 KB |
Output is correct |
6 |
Correct |
19 ms |
10584 KB |
Output is correct |
7 |
Correct |
2 ms |
4964 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
17 ms |
9304 KB |
Output is correct |
3 |
Correct |
14 ms |
8908 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
7 ms |
6236 KB |
Output is correct |
6 |
Correct |
19 ms |
10584 KB |
Output is correct |
7 |
Correct |
2 ms |
4964 KB |
Output is correct |
8 |
Correct |
40 ms |
11464 KB |
Output is correct |
9 |
Correct |
32 ms |
11752 KB |
Output is correct |
10 |
Correct |
48 ms |
14540 KB |
Output is correct |
11 |
Correct |
2 ms |
4960 KB |
Output is correct |
12 |
Correct |
2 ms |
4956 KB |
Output is correct |
13 |
Correct |
2 ms |
4960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
17 ms |
9304 KB |
Output is correct |
3 |
Correct |
14 ms |
8908 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
7 ms |
6236 KB |
Output is correct |
6 |
Correct |
19 ms |
10584 KB |
Output is correct |
7 |
Correct |
2 ms |
4964 KB |
Output is correct |
8 |
Correct |
40 ms |
11464 KB |
Output is correct |
9 |
Correct |
32 ms |
11752 KB |
Output is correct |
10 |
Correct |
48 ms |
14540 KB |
Output is correct |
11 |
Correct |
2 ms |
4960 KB |
Output is correct |
12 |
Correct |
2 ms |
4956 KB |
Output is correct |
13 |
Correct |
2 ms |
4960 KB |
Output is correct |
14 |
Correct |
70 ms |
16100 KB |
Output is correct |
15 |
Correct |
35 ms |
10684 KB |
Output is correct |
16 |
Correct |
54 ms |
13588 KB |
Output is correct |
17 |
Correct |
2 ms |
4952 KB |
Output is correct |
18 |
Correct |
2 ms |
5208 KB |
Output is correct |
19 |
Correct |
2 ms |
4956 KB |
Output is correct |
20 |
Correct |
61 ms |
15120 KB |
Output is correct |
21 |
Correct |
2 ms |
4960 KB |
Output is correct |
22 |
Correct |
2 ms |
4956 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
4964 KB |
Output is partially correct |
2 |
Correct |
45 ms |
11612 KB |
Output is correct |
3 |
Partially correct |
77 ms |
18116 KB |
Output is partially correct |
4 |
Partially correct |
82 ms |
16556 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
4964 KB |
Output is partially correct |
2 |
Correct |
45 ms |
11612 KB |
Output is correct |
3 |
Partially correct |
77 ms |
18116 KB |
Output is partially correct |
4 |
Partially correct |
82 ms |
16556 KB |
Output is partially correct |
5 |
Partially correct |
86 ms |
18048 KB |
Output is partially correct |
6 |
Partially correct |
104 ms |
19192 KB |
Output is partially correct |
7 |
Partially correct |
117 ms |
18940 KB |
Output is partially correct |
8 |
Partially correct |
103 ms |
19832 KB |
Output is partially correct |
9 |
Partially correct |
75 ms |
15832 KB |
Output is partially correct |
10 |
Partially correct |
109 ms |
19412 KB |
Output is partially correct |
11 |
Partially correct |
107 ms |
20356 KB |
Output is partially correct |
12 |
Partially correct |
70 ms |
15212 KB |
Output is partially correct |
13 |
Partially correct |
64 ms |
14348 KB |
Output is partially correct |
14 |
Partially correct |
65 ms |
14200 KB |
Output is partially correct |
15 |
Partially correct |
57 ms |
13592 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
5212 KB |
Output is partially correct |
17 |
Partially correct |
56 ms |
13084 KB |
Output is partially correct |
18 |
Partially correct |
58 ms |
13036 KB |
Output is partially correct |
19 |
Partially correct |
60 ms |
13692 KB |
Output is partially correct |
20 |
Partially correct |
78 ms |
16108 KB |
Output is partially correct |
21 |
Partially correct |
94 ms |
18236 KB |
Output is partially correct |
22 |
Partially correct |
72 ms |
15352 KB |
Output is partially correct |