# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1042119 |
2024-08-02T14:54:35 Z |
juicy |
Stray Cat (JOI20_stray) |
C++17 |
|
27 ms |
28464 KB |
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
void __print() {
cerr << "]\n";
}
template<class T, class... V>
void __print(T t, V... v) {
cerr << t;
if (sizeof...(v)) {
cerr << ", ";
}
__print(v...);
}
#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; __print(x);
#else
#define debug(...) 42
#endif
vector<int> clr, dep;
vector<vector<int>> g;
string S = "010011";
} // namespace
std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) {
clr.resize(N);
g.resize(N);
dep.resize(N, -1);
for (int i = 0; i < M; ++i) {
int u = U[i], v = V[i];
g[u].push_back(v);
g[v].push_back(u);
}
queue<int> q;
dep[0] = 0;
q.push(0);
while (q.size()) {
int u = q.front(); q.pop();
for (int v : g[u]) {
if (dep[v] == -1) {
dep[v] = dep[u] + 1;
if (A == 2) {
if (u == 0) {
clr[v] = 0;
} else if (g[u].size() == 2) {
clr[v] = (clr[u] + 1) % 6;
} else {
clr[v] = S[clr[u]] == '0';
}
}
q.push(v);
}
}
}
vector<int> X(M);
for (int i = 0; i < M; ++i) {
int u = U[i], v = V[i];
if (dep[u] < dep[v]) {
swap(u, v);
}
if (A == 2) {
X[i] = S[clr[u]] - '0';
} else {
X[i] = dep[v] % 3;
}
}
return X;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
void __print() {
cerr << "]\n";
}
template<class T, class... V>
void __print(T t, V... v) {
cerr << t;
if (sizeof...(v)) {
cerr << ", ";
}
__print(v...);
}
#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; __print(x);
#else
#define debug(...) 42
#endif
int A, B, lst = -1;
bool up;
string S;
bool check() {
for (int i = 0; i < 6; ++i) {
if (string("010011010011").substr(i, 5) == S) {
return 1;
}
}
return 0;
}
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(std::vector<int> y) {
if (up) {
return lst = find(y.begin(), y.end(), 1) - y.begin();
}
auto g = y;
if (~lst) {
++g[lst];
}
int deg = 0, cnt = 0;
for (int i = 0; i < A; ++i) {
deg += g[i];
cnt += g[i] > 0;
}
if (A == 2) {
if (deg == 2) {
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < y[i]; ++j) {
S += i + '0';
}
}
if (S.size() == 5) {
up = 1;
return check() ? -1 : lst = S.back();
}
return lst = S.back();
}
up = 1;
return lst = find(g.begin(), g.end(), 1) - g.begin();
}
if (cnt == 1) {
return lst = find(y.begin(), y.end(), 1) - y.begin();
}
if (lst == -1) {
for (int i = 0; i < 3; ++i) {
if (y[i] == 0) {
lst = i;
}
}
}
int nxt = lst == 0 ? 2 : lst - 1;
assert(y[nxt]);
return lst = nxt;
}
Compilation message
Anthony.cpp:8:8: warning: 'void {anonymous}::__print()' defined but not used [-Wunused-function]
8 | void __print() {
| ^~~~~~~
Catherine.cpp:8:8: warning: 'void {anonymous}::__print()' defined but not used [-Wunused-function]
8 | void __print() {
| ^~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
28464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
28464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
13648 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
13648 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1056 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
11880 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
11864 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |