# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1012810 |
2024-07-02T16:03:42 Z |
Ivo_12 |
Stray Cat (JOI20_stray) |
C++17 |
|
1601 ms |
524288 KB |
#include "Anthony.h"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair < int, int >
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
namespace {
const int N = 2e4+10, M = 2e4+10, A = 4;
vector < pii > edges[N];
vector < int > oznake;
int dis[N];
queue < int > q;
vector < int > mark( int n, int m, int a, int b, vector < int > t1, vector < int > t2 ) {
for(int i = 0; i < m; i++) {
::edges[t1[i]].pb(mp(t2[i], i));
::edges[t2[i]].pb(mp(t1[i], i));
::oznake.pb(0);
}
::dis[0] = 1;
::q.push(0);
int cur;
int sus;
while(!::q.empty()) {
cur = ::q.front();
::q.pop();
for(int i = 0; i < (int) ::edges[cur].size(); i++) {
sus = ::edges[cur][i].F;
if(::dis[sus] == 0) {
::q.push(sus);
::dis[sus] = ::dis[cur]+1;
}
}
}
if(a>=3) {
::q.push(0);
while(!::q.empty()) {
cur = ::q.front();
::q.pop();
for(int i = 0; i < (int) ::edges[cur].size(); i++) {
sus = ::edges[cur][i].F;
if(::dis[sus] >= ::dis[cur]) {
::q.push(sus);
::oznake[::edges[cur][i].S] = (::dis[cur] - 1) % 3;
}
}
}
}
else {
}
return ::oznake;
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
std::vector<int> X(M);
return ::mark(N, M, A, B, U, V);
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair < int, int >
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
namespace {
int ga, gb;
void init( int a, int b ) {
ga = a;
gb = b;
}
int move( vector < int > v ) {
if(::ga>=3) {
if(v[0] && v[1]) return 0;
if(v[2] && v[0]) return 2;
if(v[1] && v[2]) return 1;
if(!(v[0] || v[1])) return 2;
if(!(v[2] || v[0])) return 1;
if(!(v[1] || v[2])) return 0;
}
return -1;
}
} // namespace
void Init(int A, int B) {
::init(A, B);
}
int Move(std::vector<int> y) {
return ::move(y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
15992 KB |
Output is correct |
2 |
Correct |
1 ms |
1304 KB |
Output is correct |
3 |
Correct |
24 ms |
15544 KB |
Output is correct |
4 |
Correct |
31 ms |
16912 KB |
Output is correct |
5 |
Correct |
34 ms |
17024 KB |
Output is correct |
6 |
Correct |
25 ms |
15748 KB |
Output is correct |
7 |
Correct |
33 ms |
15744 KB |
Output is correct |
8 |
Correct |
31 ms |
16512 KB |
Output is correct |
9 |
Correct |
37 ms |
16424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
15992 KB |
Output is correct |
2 |
Correct |
1 ms |
1304 KB |
Output is correct |
3 |
Correct |
24 ms |
15544 KB |
Output is correct |
4 |
Correct |
31 ms |
16912 KB |
Output is correct |
5 |
Correct |
34 ms |
17024 KB |
Output is correct |
6 |
Correct |
25 ms |
15748 KB |
Output is correct |
7 |
Correct |
33 ms |
15744 KB |
Output is correct |
8 |
Correct |
31 ms |
16512 KB |
Output is correct |
9 |
Correct |
37 ms |
16424 KB |
Output is correct |
10 |
Runtime error |
1601 ms |
524288 KB |
Execution killed with signal 9 |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
13408 KB |
Output is correct |
2 |
Correct |
0 ms |
1308 KB |
Output is correct |
3 |
Correct |
20 ms |
13188 KB |
Output is correct |
4 |
Correct |
31 ms |
14984 KB |
Output is correct |
5 |
Correct |
36 ms |
14920 KB |
Output is correct |
6 |
Correct |
28 ms |
13448 KB |
Output is correct |
7 |
Correct |
23 ms |
13452 KB |
Output is correct |
8 |
Correct |
30 ms |
14148 KB |
Output is correct |
9 |
Correct |
27 ms |
14216 KB |
Output is correct |
10 |
Correct |
26 ms |
13904 KB |
Output is correct |
11 |
Correct |
26 ms |
13968 KB |
Output is correct |
12 |
Correct |
26 ms |
13948 KB |
Output is correct |
13 |
Correct |
34 ms |
13916 KB |
Output is correct |
14 |
Correct |
38 ms |
14072 KB |
Output is correct |
15 |
Correct |
29 ms |
14204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
13408 KB |
Output is correct |
2 |
Correct |
0 ms |
1308 KB |
Output is correct |
3 |
Correct |
20 ms |
13188 KB |
Output is correct |
4 |
Correct |
31 ms |
14984 KB |
Output is correct |
5 |
Correct |
36 ms |
14920 KB |
Output is correct |
6 |
Correct |
28 ms |
13448 KB |
Output is correct |
7 |
Correct |
23 ms |
13452 KB |
Output is correct |
8 |
Correct |
30 ms |
14148 KB |
Output is correct |
9 |
Correct |
27 ms |
14216 KB |
Output is correct |
10 |
Correct |
26 ms |
13904 KB |
Output is correct |
11 |
Correct |
26 ms |
13968 KB |
Output is correct |
12 |
Correct |
26 ms |
13948 KB |
Output is correct |
13 |
Correct |
34 ms |
13916 KB |
Output is correct |
14 |
Correct |
38 ms |
14072 KB |
Output is correct |
15 |
Correct |
29 ms |
14204 KB |
Output is correct |
16 |
Runtime error |
1521 ms |
524288 KB |
Execution killed with signal 9 |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1556 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
11264 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
11268 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |