# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
260986 |
2020-08-11T09:08:46 Z |
sjimed |
Stray Cat (JOI20_stray) |
C++14 |
|
59 ms |
20304 KB |
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
namespace {
vector<int> g[200010];
int d[200010] = {};
int num[200010] = {};
int ret[200010] = {1, };
int tb[6] = {1, 1, 0, 1, 0, 0};
int p[200010] = {};
int f(int i) {
if(ret[i] < 2) return ret[i];
return tb[ret[i] % 6];
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
for(int i=0; i<M; i++) g[U[i]].eb(V[i]), g[V[i]].eb(U[i]);
queue<int> q;
q.em(0);
d[0] = 1;
vector<int> v;
while(q.size()) {
int x = q.front();
q.pop();
v.eb(x);
for(auto i : g[x]) {
if(d[i]) continue;
if(g[i].size() == 2 && g[x].size() == 2 && x != 0) ret[i] = 2;
else if(x == 0 || g[x].size() != 2) ret[i] = 1 - ret[x];
else ret[i] = 1;
p[i] = x;
d[i] = d[x] + 1;
q.em(i);
}
}
reverse(all(v));
for(auto i : v) {
if(ret[i] != 2) continue;
if(g[i][0] != p[i]) ret[i] = ret[g[i][0]] + 1;
else ret[i] = ret[g[i][1]] + 1;
}
std::vector<int> X(M);
for (int i = 0; i < M; ++i) {
if(p[U[i]] == V[i]) X[i] = f(U[i]);
else X[i] = f(V[i]);
// cout << X[i];
}
//cout << endl;
return X;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
namespace {
int cnt = 0;
int a, b;
int x = 0;
} // namespace
void Init(int A, int B) {
a = A;
b = B;
}
int Move(std::vector<int> y) {
//cout << "!" << x << endl;
if(y[0] + y[1] == 0) {
cnt = 4;
return -1;
}
if(y[0] > y[1] && y[1] >= 1) {
cnt = 4;
return 1;
}
if(y[1] > y[0] && y[0] >= 1) {
cnt = 4;
return 0;
}
if(y[0] > 2) {
cnt = 4;
return -1;
}
if(y[1] > 2) {
cnt = 4;
return -1;
}
if(y[0] + y[1] == 2) {
cnt = 0;
if(y[0] == 0) {
x = 3;
return 1;
}
if(y[0] == 1) {
if(x & 1) {
x = 2;
return 0;
}
else {
x = 1;
return 1;
}
}
else {
if(x & 1) {
cnt = 4;
return -1;
}
return 0;
}
}
if(y[0] + y[1] == 1) {
cnt++;
x <<= 1;
x |= y[1];
x &= 31;
//cout << cnt << " " << x << endl;
if(cnt == 3) {
if(x == 5 || x == 11 || x == 22 || x == 12 || x == 25 || x == 18) {
cnt = 4;
return -1;
}
else {
cnt = 4;
return y[1];
}
}
return y[1];
}
}
Compilation message
Anthony.cpp:23:5: warning: '{anonymous}::num' defined but not used [-Wunused-variable]
int num[200010] = {};
^~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:103:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
20304 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
20304 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
18076 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
18076 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
10240 KB |
Output is correct |
2 |
Correct |
3 ms |
9984 KB |
Output is correct |
3 |
Correct |
5 ms |
10240 KB |
Output is correct |
4 |
Correct |
5 ms |
10240 KB |
Output is correct |
5 |
Correct |
5 ms |
10240 KB |
Output is correct |
6 |
Correct |
5 ms |
10240 KB |
Output is correct |
7 |
Correct |
5 ms |
10240 KB |
Output is correct |
8 |
Correct |
5 ms |
10240 KB |
Output is correct |
9 |
Correct |
5 ms |
10240 KB |
Output is correct |
10 |
Correct |
6 ms |
10240 KB |
Output is correct |
11 |
Correct |
6 ms |
10240 KB |
Output is correct |
12 |
Correct |
5 ms |
10240 KB |
Output is correct |
13 |
Correct |
6 ms |
10240 KB |
Output is correct |
14 |
Correct |
5 ms |
10240 KB |
Output is correct |
15 |
Correct |
5 ms |
10240 KB |
Output is correct |
16 |
Correct |
5 ms |
10240 KB |
Output is correct |
17 |
Correct |
5 ms |
10240 KB |
Output is correct |
18 |
Correct |
5 ms |
10240 KB |
Output is correct |
19 |
Correct |
6 ms |
10240 KB |
Output is correct |
20 |
Correct |
6 ms |
10240 KB |
Output is correct |
21 |
Correct |
7 ms |
10240 KB |
Output is correct |
22 |
Correct |
5 ms |
10240 KB |
Output is correct |
23 |
Correct |
5 ms |
10240 KB |
Output is correct |
24 |
Correct |
5 ms |
10240 KB |
Output is correct |
25 |
Correct |
6 ms |
10240 KB |
Output is correct |
26 |
Correct |
5 ms |
10240 KB |
Output is correct |
27 |
Correct |
5 ms |
10240 KB |
Output is correct |
28 |
Correct |
5 ms |
10240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
16148 KB |
Output is correct |
2 |
Incorrect |
56 ms |
16880 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
16140 KB |
Output is correct |
2 |
Incorrect |
52 ms |
17088 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |