# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
514011 |
2022-01-18T02:17:53 Z |
8e7 |
Stray Cat (JOI20_stray) |
C++17 |
|
46 ms |
16148 KB |
#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>
#define maxn 20005
#define pii pair<int, int>
using namespace std;
namespace {
vector<pii> adj[maxn];
int res[maxn];
int arr[6] = {0, 0, 1, 0, 1, 1};
const int inf = 8e7;
void dfs(int n, int par, int ind, int prv) {
int deg = adj[n].size() - (par == -1 ? 0 : 1);
if (deg == 1) {
for (auto [v, id]:adj[n]) {
if (v != par) {
res[id] = arr[ind];
dfs(v, n, (ind+1)%6, res[id]);
}
}
} else {
for (auto [v, id]:adj[n]) {
if (v != par) {
res[id] = prv ^ 1;
dfs(v, n, res[id] ? 5 : 1, res[id]);
}
}
}
}
};
vector<int> Mark(int N, int M, int A, int B,
vector<int> U, vector<int> V) {
for (int i = 0;i < M;i++) adj[U[i]].push_back({V[i], i}), adj[V[i]].push_back({U[i], i});
vector<int> X(M);
dfs(0, -1, 0, 0);
for (int i = 0;i < M;i++) X[i] = res[i];
return X;
}
#include "Catherine.h"
#include <vector>
#include "assert.h"
using namespace std;
namespace {
int A, B;
bool type = 0;
int prv = 0, step = 0, mask = 0;
int check[6] = {11, 22, 44, 25, 50, 37};
};
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(vector<int> y) {
int sum = y[0] + y[1];
sum += (step ? 1 : 0);
if (sum > 2) {
step++;
if (y[0] == 0 || y[1] == 0) {
return -1;
}
if (step > 1) y[prv]++;
prv = y[0] == 1 ? 0 : 1;
return prv;
} else {
if (step) sum--;
step++;
if (sum == 1) {
if (type && step == 6) {
bool match = 0;
for (int i = 0;i < 6;i++) {
if (mask == check[i]) match = 1;
}
if (match) return -1;
}
prv = y[0] == 1 ? 0 : 1;
return prv;
} else {
if (sum == 0) return -1;
prv = y[0] ? 0 : 1;
type = 1;
return prv;
}
}
}
/*
11 10 2 6 6
0 2
0 3
0 4
3 5
5 7
5 8
7 10
4 6
6 9
9 1
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
16148 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
16148 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
13688 KB |
Output is correct |
2 |
Correct |
1 ms |
948 KB |
Output is correct |
3 |
Correct |
37 ms |
12808 KB |
Output is correct |
4 |
Correct |
46 ms |
15412 KB |
Output is correct |
5 |
Incorrect |
40 ms |
15464 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
13688 KB |
Output is correct |
2 |
Correct |
1 ms |
948 KB |
Output is correct |
3 |
Correct |
37 ms |
12808 KB |
Output is correct |
4 |
Correct |
46 ms |
15412 KB |
Output is correct |
5 |
Incorrect |
40 ms |
15464 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1272 KB |
Output is correct |
2 |
Correct |
1 ms |
1060 KB |
Output is correct |
3 |
Correct |
2 ms |
1260 KB |
Output is correct |
4 |
Correct |
2 ms |
1264 KB |
Output is correct |
5 |
Correct |
2 ms |
1264 KB |
Output is correct |
6 |
Correct |
2 ms |
1276 KB |
Output is correct |
7 |
Correct |
2 ms |
1260 KB |
Output is correct |
8 |
Correct |
2 ms |
1260 KB |
Output is correct |
9 |
Correct |
2 ms |
1316 KB |
Output is correct |
10 |
Correct |
2 ms |
1328 KB |
Output is correct |
11 |
Correct |
2 ms |
1260 KB |
Output is correct |
12 |
Correct |
2 ms |
1272 KB |
Output is correct |
13 |
Correct |
1 ms |
1272 KB |
Output is correct |
14 |
Correct |
3 ms |
1460 KB |
Output is correct |
15 |
Correct |
2 ms |
1328 KB |
Output is correct |
16 |
Correct |
2 ms |
1260 KB |
Output is correct |
17 |
Correct |
2 ms |
1264 KB |
Output is correct |
18 |
Correct |
2 ms |
1264 KB |
Output is correct |
19 |
Correct |
2 ms |
1276 KB |
Output is correct |
20 |
Correct |
2 ms |
1320 KB |
Output is correct |
21 |
Correct |
3 ms |
1264 KB |
Output is correct |
22 |
Correct |
2 ms |
1264 KB |
Output is correct |
23 |
Correct |
2 ms |
1316 KB |
Output is correct |
24 |
Correct |
2 ms |
1264 KB |
Output is correct |
25 |
Correct |
2 ms |
1312 KB |
Output is correct |
26 |
Correct |
2 ms |
1268 KB |
Output is correct |
27 |
Correct |
2 ms |
1296 KB |
Output is correct |
28 |
Correct |
2 ms |
1276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
11364 KB |
Output is correct |
2 |
Correct |
32 ms |
12572 KB |
Output is correct |
3 |
Correct |
1 ms |
1004 KB |
Output is correct |
4 |
Correct |
27 ms |
11472 KB |
Output is correct |
5 |
Correct |
37 ms |
13904 KB |
Output is correct |
6 |
Correct |
38 ms |
13928 KB |
Output is correct |
7 |
Correct |
32 ms |
13000 KB |
Output is correct |
8 |
Correct |
37 ms |
12944 KB |
Output is correct |
9 |
Correct |
38 ms |
14012 KB |
Output is correct |
10 |
Correct |
38 ms |
13928 KB |
Output is correct |
11 |
Correct |
41 ms |
13980 KB |
Output is correct |
12 |
Correct |
36 ms |
14000 KB |
Output is correct |
13 |
Correct |
39 ms |
13976 KB |
Output is correct |
14 |
Correct |
40 ms |
14008 KB |
Output is correct |
15 |
Correct |
39 ms |
13884 KB |
Output is correct |
16 |
Correct |
40 ms |
13920 KB |
Output is correct |
17 |
Incorrect |
33 ms |
13600 KB |
Wrong Answer [6] |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
11364 KB |
Output is correct |
2 |
Correct |
33 ms |
12404 KB |
Output is correct |
3 |
Correct |
1 ms |
1012 KB |
Output is correct |
4 |
Correct |
26 ms |
11276 KB |
Output is correct |
5 |
Correct |
45 ms |
14052 KB |
Output is correct |
6 |
Correct |
38 ms |
13920 KB |
Output is correct |
7 |
Incorrect |
28 ms |
13100 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |