답안 #291528

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
291528 2020-09-05T13:03:24 Z zoooma13 길고양이 (JOI20_stray) C++14
0 / 100
49 ms 16480 KB
#include <bits/stdc++.h>
#include "Anthony.h"
using namespace std;

#define all(v) v.begin() ,v.end()

namespace{
    vector <vector<pair<int ,int>>> adj;
    vector <int> enc ,seq = {0,0,1,0,1,1};
    void dfs(int u ,int d=0 ,bool bef=0){
        for(auto&e : adj[u]){
            adj[e.first].erase(find(all(adj[e.first]) ,make_pair(u ,e.second)));
            if(adj[u].size() > 1){
                enc[e.second] = bef^1;
                dfs(e.first ,0 ,enc[e.second]);
            }else{
                if(d == 0) d = (bef? 0 : 2);
                enc[e.second] = seq[d%6];
                dfs(e.first ,d+1 ,enc[e.second]);
            }
        }
    }
}

vector <int> Mark(int N, int M, int A, int B,vector<int> U,vector<int> V){
    assert(M == N-1);
    adj.resize(N);
    enc.resize(M);
    for(int i=0; i<M; i++){
        adj[U[i]].push_back({V[i] ,i});
        adj[V[i]].push_back({U[i] ,i});
    }
    dfs(0);
    return enc;
}

/**
001011
001101
010011
010110
011001
011010
100101
100110
101001
101100
110010
110100
*/
#include <bits/stdc++.h>
#include "Catherine.h"
using namespace std;

namespace{
    int lst;
    vector <int> bef ,seq = {0,0,1,0,1,1};
}

void Init(int A, int B) {  }

int Move(vector<int> y){
    if(!y[0] && !y[1]){
        bef.clear();
        return -1;
    }

    if(y[0] < y[1] && y[0]){
        bef.clear();
        return lst = 0;
    }
    if(y[1] < y[0] && y[1]){
        bef.clear();
        return lst = 1;
    }

    if(bef.size() == 6){
        for(int t=0; t<6; t++){
            if(bef == seq){
                bef.clear();
                return -1;
            }
            seq.insert(seq.begin() ,seq.back()) ,seq.pop_back();
        }
    }

    if(y[lst^1])
        lst ^= 1;

    bef.push_back(lst);
    return lst;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 16480 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 16480 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 13980 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 13980 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 972 KB Output is correct
2 Correct 1 ms 916 KB Output is correct
3 Correct 2 ms 1124 KB Output is correct
4 Correct 2 ms 1080 KB Output is correct
5 Correct 2 ms 1036 KB Output is correct
6 Correct 2 ms 1080 KB Output is correct
7 Correct 2 ms 1092 KB Output is correct
8 Correct 2 ms 1036 KB Output is correct
9 Correct 2 ms 1084 KB Output is correct
10 Correct 2 ms 1088 KB Output is correct
11 Correct 2 ms 1092 KB Output is correct
12 Correct 2 ms 1264 KB Output is correct
13 Correct 2 ms 908 KB Output is correct
14 Correct 2 ms 912 KB Output is correct
15 Correct 2 ms 1296 KB Output is correct
16 Correct 2 ms 1108 KB Output is correct
17 Correct 2 ms 1040 KB Output is correct
18 Correct 2 ms 1112 KB Output is correct
19 Correct 2 ms 1040 KB Output is correct
20 Correct 2 ms 1040 KB Output is correct
21 Correct 2 ms 1040 KB Output is correct
22 Correct 2 ms 912 KB Output is correct
23 Correct 2 ms 1040 KB Output is correct
24 Correct 2 ms 1040 KB Output is correct
25 Correct 2 ms 912 KB Output is correct
26 Correct 2 ms 1040 KB Output is correct
27 Correct 2 ms 1040 KB Output is correct
28 Incorrect 2 ms 912 KB Wrong Answer [6]
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 11604 KB Output is correct
2 Incorrect 46 ms 12644 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 11608 KB Output is correct
2 Incorrect 43 ms 12548 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -