답안 #799054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799054 2023-07-31T09:05:03 Z burythelightdeepwithin 길고양이 (JOI20_stray) C++14
0 / 100
38 ms 17240 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[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] > 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;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 17240 KB Output is correct
2 Incorrect 1 ms 1568 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 17240 KB Output is correct
2 Incorrect 1 ms 1568 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 14684 KB Output is correct
2 Incorrect 1 ms 1536 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 14684 KB Output is correct
2 Incorrect 1 ms 1536 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1796 KB Output is correct
2 Correct 1 ms 1540 KB Output is correct
3 Correct 1 ms 1804 KB Output is correct
4 Incorrect 2 ms 1796 KB Wrong Answer [5]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 12660 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 12652 KB Output is correct
2 Correct 27 ms 13424 KB Output is correct
3 Incorrect 1 ms 1536 KB Wrong Answer [5]
4 Halted 0 ms 0 KB -