Submission #799073

# Submission time Handle Problem Language Result Execution time Memory
799073 2023-07-31T09:24:24 Z burythelightdeepwithin Stray Cat (JOI20_stray) C++14
5 / 100
41 ms 18660 KB
#include <bits/stdc++.h>
#include "Anthony.h"

using namespace std;

vector <pair <int, int> > adj[20003], adj_dfs[20003];
vector <int> plan;
int vs[20003];
queue <int> q;
vector <int> leaf;

void bfs(){
    while(!q.empty()){
        int u = q.front();
        vs[u] = 1;
        q.pop();
        for (auto e: adj[u]){
            int v = e.first, id = e.second;
            if (!vs[v]){
                q.push(v);
                vs[v] = 1;
                adj_dfs[u].push_back({v, id});
                adj_dfs[v].push_back({u, id});
            }
        }
    }
}

void dfs(int u, int mark){
    vs[u] = 1;
    for (auto e: adj_dfs[u]){
        int v = e.first, id = e.second;
        if (!vs[v]){
            plan[id] = mark;
            dfs(v, (mark^1));
        }
    }
}

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});
        plan.push_back(-1);
    }
    q.push(0);
    bfs();
    for (int i = 0; i < N; i++){
        vs[i] = 0;
    }
    dfs(0, 0);
    for (int i = 0; i < M; i++){
        if (plan[i] == -1){
            plan[i] = 2;
        }
    }
    return plan;
}
#include <bits/stdc++.h>
#include "Catherine.h"

using namespace std;

int first = -1, last = -1, cnt = 0;

void Init(int A, int B){

}

int Move(vector <int> y){
    if (first == -1){
        if (last == -1){
            if (y[0] == 0){
                first = 1;
                return first;
            } else if (y[1] == 0){
                first = 0;
                return first;
            }
            if (y[0] > y[1]){
                first = 1;
                return first;
            } else if (y[0] < y[1]){
                first = 0;
                return first;
            } else {
                last = 1;
                return 1;
            }
        } else {
            if (y[last^1] != 1){
                first = last;
                return -1;
            } else {
                last ^= 1;
                return last;
            }
        }
    } else {
        first ^= 1;
        return first;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 37 ms 17164 KB Output is correct
2 Correct 1 ms 1532 KB Output is correct
3 Correct 24 ms 16152 KB Output is correct
4 Correct 35 ms 18572 KB Output is correct
5 Correct 36 ms 18660 KB Output is correct
6 Incorrect 30 ms 16740 KB Wrong Answer [6]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 17164 KB Output is correct
2 Correct 1 ms 1532 KB Output is correct
3 Correct 24 ms 16152 KB Output is correct
4 Correct 35 ms 18572 KB Output is correct
5 Correct 36 ms 18660 KB Output is correct
6 Incorrect 30 ms 16740 KB Wrong Answer [6]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 14800 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 26 ms 13920 KB Output is correct
4 Correct 41 ms 16452 KB Output is correct
5 Correct 33 ms 16424 KB Output is correct
6 Correct 28 ms 14632 KB Output is correct
7 Incorrect 26 ms 14580 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 14800 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 26 ms 13920 KB Output is correct
4 Correct 41 ms 16452 KB Output is correct
5 Correct 33 ms 16424 KB Output is correct
6 Correct 28 ms 14632 KB Output is correct
7 Incorrect 26 ms 14580 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1796 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 1 ms 1796 KB Output is correct
4 Correct 2 ms 1800 KB Output is correct
5 Correct 2 ms 1804 KB Output is correct
6 Correct 2 ms 1876 KB Output is correct
7 Correct 2 ms 1796 KB Output is correct
8 Correct 2 ms 1812 KB Output is correct
9 Correct 2 ms 1800 KB Output is correct
10 Correct 2 ms 1820 KB Output is correct
11 Correct 2 ms 1808 KB Output is correct
12 Correct 2 ms 1784 KB Output is correct
13 Correct 2 ms 1808 KB Output is correct
14 Correct 2 ms 1804 KB Output is correct
15 Correct 2 ms 1808 KB Output is correct
16 Correct 2 ms 1808 KB Output is correct
17 Correct 2 ms 1800 KB Output is correct
18 Correct 2 ms 1808 KB Output is correct
19 Correct 2 ms 1808 KB Output is correct
20 Correct 1 ms 1812 KB Output is correct
21 Correct 2 ms 1812 KB Output is correct
22 Correct 2 ms 1804 KB Output is correct
23 Correct 2 ms 1800 KB Output is correct
24 Correct 2 ms 1808 KB Output is correct
25 Correct 2 ms 1884 KB Output is correct
26 Correct 2 ms 1804 KB Output is correct
27 Correct 2 ms 1808 KB Output is correct
28 Correct 3 ms 2084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 12548 KB Output is correct
2 Correct 28 ms 13440 KB Output is correct
3 Correct 1 ms 1556 KB Output is correct
4 Correct 23 ms 12820 KB Output is correct
5 Correct 32 ms 15296 KB Output is correct
6 Correct 34 ms 15224 KB Output is correct
7 Incorrect 25 ms 14396 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 12664 KB Output is correct
2 Correct 28 ms 13336 KB Output is correct
3 Correct 1 ms 1544 KB Output is correct
4 Correct 23 ms 12832 KB Output is correct
5 Correct 32 ms 15372 KB Output is correct
6 Correct 32 ms 15288 KB Output is correct
7 Incorrect 33 ms 14448 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -