# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
513246 |
2022-01-17T04:36:06 Z |
wiwiho |
Stray Cat (JOI20_stray) |
C++14 |
|
48 ms |
16028 KB |
#include "Anthony.h"
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
namespace {
} // namespace
vector<int> Mark(int n, int m, int A, int B,
vector<int> U, vector<int> V) {
assert(A >= 3);
vector<int> ans(m);
vector<vector<int>> g(n);
for(int i = 0; i < m; i++){
int u = U[i], v = V[i];
g[u].eb(v);
g[v].eb(u);
}
vector<int> dis(n, -1);
dis[0] = 0;
queue<int> q;
q.push(0);
while(!q.empty()){
int now = q.front();
q.pop();
for(int i : g[now]){
if(dis[i] != -1) continue;
dis[i] = dis[now] + 1;
q.push(i);
}
}
for(int i = 0; i < m; i++){
int u = U[i], v = V[i];
if(dis[u] > dis[v]) swap(u, v);
int t = dis[u] == dis[v] ? dis[v] + 1 : dis[v];
t %= 3;
ans[i] = t;
}
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
namespace {
int A, B;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(vector<int> y) {
vector<int> t;
for(int i = 0; i < A; i++){
if(y[i]) t.eb(i);
}
if(t.size() == 1) return t[0];
if(t[0] == 0 && t[1] == 2) return 2;
return t[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
15056 KB |
Output is correct |
2 |
Correct |
0 ms |
496 KB |
Output is correct |
3 |
Correct |
32 ms |
14320 KB |
Output is correct |
4 |
Correct |
43 ms |
16028 KB |
Output is correct |
5 |
Correct |
46 ms |
15960 KB |
Output is correct |
6 |
Correct |
33 ms |
14816 KB |
Output is correct |
7 |
Correct |
48 ms |
14776 KB |
Output is correct |
8 |
Correct |
43 ms |
15576 KB |
Output is correct |
9 |
Correct |
40 ms |
15552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
15056 KB |
Output is correct |
2 |
Correct |
0 ms |
496 KB |
Output is correct |
3 |
Correct |
32 ms |
14320 KB |
Output is correct |
4 |
Correct |
43 ms |
16028 KB |
Output is correct |
5 |
Correct |
46 ms |
15960 KB |
Output is correct |
6 |
Correct |
33 ms |
14816 KB |
Output is correct |
7 |
Correct |
48 ms |
14776 KB |
Output is correct |
8 |
Correct |
43 ms |
15576 KB |
Output is correct |
9 |
Correct |
40 ms |
15552 KB |
Output is correct |
10 |
Correct |
33 ms |
12864 KB |
Output is correct |
11 |
Correct |
34 ms |
12792 KB |
Output is correct |
12 |
Correct |
34 ms |
12760 KB |
Output is correct |
13 |
Correct |
32 ms |
12832 KB |
Output is correct |
14 |
Correct |
33 ms |
13004 KB |
Output is correct |
15 |
Correct |
41 ms |
13308 KB |
Output is correct |
16 |
Correct |
46 ms |
15664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
12604 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
27 ms |
12260 KB |
Output is correct |
4 |
Correct |
40 ms |
13900 KB |
Output is correct |
5 |
Correct |
48 ms |
13752 KB |
Output is correct |
6 |
Correct |
35 ms |
12568 KB |
Output is correct |
7 |
Correct |
31 ms |
12640 KB |
Output is correct |
8 |
Correct |
38 ms |
13272 KB |
Output is correct |
9 |
Correct |
39 ms |
13212 KB |
Output is correct |
10 |
Correct |
40 ms |
12988 KB |
Output is correct |
11 |
Correct |
37 ms |
12968 KB |
Output is correct |
12 |
Correct |
35 ms |
13008 KB |
Output is correct |
13 |
Correct |
35 ms |
12972 KB |
Output is correct |
14 |
Correct |
38 ms |
13340 KB |
Output is correct |
15 |
Correct |
43 ms |
13320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
12604 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
27 ms |
12260 KB |
Output is correct |
4 |
Correct |
40 ms |
13900 KB |
Output is correct |
5 |
Correct |
48 ms |
13752 KB |
Output is correct |
6 |
Correct |
35 ms |
12568 KB |
Output is correct |
7 |
Correct |
31 ms |
12640 KB |
Output is correct |
8 |
Correct |
38 ms |
13272 KB |
Output is correct |
9 |
Correct |
39 ms |
13212 KB |
Output is correct |
10 |
Correct |
40 ms |
12988 KB |
Output is correct |
11 |
Correct |
37 ms |
12968 KB |
Output is correct |
12 |
Correct |
35 ms |
13008 KB |
Output is correct |
13 |
Correct |
35 ms |
12972 KB |
Output is correct |
14 |
Correct |
38 ms |
13340 KB |
Output is correct |
15 |
Correct |
43 ms |
13320 KB |
Output is correct |
16 |
Correct |
27 ms |
10968 KB |
Output is correct |
17 |
Correct |
27 ms |
10920 KB |
Output is correct |
18 |
Correct |
28 ms |
10840 KB |
Output is correct |
19 |
Correct |
44 ms |
10948 KB |
Output is correct |
20 |
Correct |
33 ms |
11488 KB |
Output is correct |
21 |
Correct |
32 ms |
11180 KB |
Output is correct |
22 |
Correct |
37 ms |
13392 KB |
Output is correct |
23 |
Correct |
30 ms |
11036 KB |
Output is correct |
24 |
Correct |
30 ms |
10944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
972 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
972 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |