답안 #947414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
947414 2024-03-16T06:53:55 Z phoenix0423 길고양이 (JOI20_stray) C++17
4 / 100
40 ms 16780 KB
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pll;
#define pb push_back
#define eb emplace_back
const int INF = 1e9;
#include "Anthony.h"

vector<int> Mark(int n, int m, int a, int b, vector<int> u, vector<int> v){
    vector<vector<pll>> adj(n);
    vector<int> dist(n, INF), deg(n);
    dist[0] = 0;
    for(int i = 0; i < m; i++){
        adj[u[i]].eb(v[i], i);
        adj[v[i]].eb(u[i], i);
        deg[u[i]] ++, deg[v[i]] ++;
    }
    vector<int> color(m);
    queue<pll> q;
    q.push({0, 0});
    if(a >= 3){
        while(!q.empty()){
            auto [pos, lst] = q.front(); q.pop();
            for(auto [x, id] : adj[pos]){
                if(dist[x] != INF) continue;
                dist[x] = dist[pos] + 1;
                color[id] = (lst + 1) % a;
                q.push({x, color[id]});
            }
        }
    }
    else{
        string ck = "121221";
        while(!q.empty()){
            auto [pos, lst] = q.front(); q.pop();
            int put;
            if(deg[pos] > 2){
                if(ck[lst] == '1') put = 1;
                else put = 0;
            }
            else put = (lst + 1) % 6;
            for(auto [x, id] : adj[pos]){
                if(dist[x] != INF) continue;
                dist[x] = dist[pos] + 1;
                color[id] = (ck[put] - '1');
                q.push({x, put});
            }
        }
    }
    return color;
}

// signed main(void){
//     int n, m, a, b, s;
//     cin>>n>>m>>a>>b>>s;
//     vector<int> u(m), v(m);
//     for(int i = 0; i < m; i++) cin>>u[i]>>v[i];
//     auto c = Mark(n, m, a, b, u, v);
//     for(auto x : c) cout<<x<<" ";
//     cout<<"\n";
// }
#include "Catherine.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;

int A, B, lst = -1, move = 0, ok = 0;
string ps = "";

void Init(int a, int b){
    A = a, B = b;
}

int Move(vector<int> y){
    // cout<<"ck : "<<A<<" "<<B<<"\n";
    if(lst != -1) y[lst]++;
    int deg = accumulate(y.begin(), y.end(), 0);
    if(deg == 1){
        return max_element(y.begin(), y.end()) - y.begin();
    }
    if(true){
        for(int i = 0; i < A; i++){
            // cout<<"try : "<<y[i]<<" "<<y[(i + 1) % A]<<"\n";
            if(y[i] == 1 && y[(i + 1) % A]){
                return i;
            }
        }
    }
    return 0;
    if(deg > 2){
        if(lst) return lst ^ 1;
        else return y[0] != 1;
    }
    if(ok){

    }
}
/*
7 6 3 6 1
0 2
0 4
1 2
1 3
1 5
4 6
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 15480 KB Output is correct
2 Correct 0 ms 796 KB Output is correct
3 Correct 23 ms 15152 KB Output is correct
4 Correct 37 ms 16780 KB Output is correct
5 Correct 40 ms 16676 KB Output is correct
6 Correct 28 ms 15768 KB Output is correct
7 Correct 30 ms 15692 KB Output is correct
8 Correct 34 ms 16136 KB Output is correct
9 Correct 34 ms 16096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 15480 KB Output is correct
2 Correct 0 ms 796 KB Output is correct
3 Correct 23 ms 15152 KB Output is correct
4 Correct 37 ms 16780 KB Output is correct
5 Correct 40 ms 16676 KB Output is correct
6 Correct 28 ms 15768 KB Output is correct
7 Correct 30 ms 15692 KB Output is correct
8 Correct 34 ms 16136 KB Output is correct
9 Correct 34 ms 16096 KB Output is correct
10 Incorrect 25 ms 13712 KB Wrong Answer [6]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 12908 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 23 ms 12888 KB Output is correct
4 Correct 33 ms 14724 KB Output is correct
5 Correct 33 ms 14964 KB Output is correct
6 Correct 27 ms 13384 KB Output is correct
7 Correct 26 ms 13456 KB Output is correct
8 Correct 38 ms 13864 KB Output is correct
9 Correct 31 ms 13948 KB Output is correct
10 Correct 28 ms 13756 KB Output is correct
11 Correct 27 ms 13692 KB Output is correct
12 Correct 31 ms 13700 KB Output is correct
13 Correct 28 ms 13704 KB Output is correct
14 Correct 32 ms 13884 KB Output is correct
15 Correct 31 ms 13792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 12908 KB Output is correct
2 Correct 0 ms 784 KB Output is correct
3 Correct 23 ms 12888 KB Output is correct
4 Correct 33 ms 14724 KB Output is correct
5 Correct 33 ms 14964 KB Output is correct
6 Correct 27 ms 13384 KB Output is correct
7 Correct 26 ms 13456 KB Output is correct
8 Correct 38 ms 13864 KB Output is correct
9 Correct 31 ms 13948 KB Output is correct
10 Correct 28 ms 13756 KB Output is correct
11 Correct 27 ms 13692 KB Output is correct
12 Correct 31 ms 13700 KB Output is correct
13 Correct 28 ms 13704 KB Output is correct
14 Correct 32 ms 13884 KB Output is correct
15 Correct 31 ms 13792 KB Output is correct
16 Incorrect 22 ms 11460 KB Wrong Answer [6]
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1052 KB Output is correct
2 Correct 1 ms 784 KB Output is correct
3 Correct 2 ms 1100 KB Output is correct
4 Correct 2 ms 1144 KB Output is correct
5 Correct 2 ms 1048 KB Output is correct
6 Correct 2 ms 1044 KB Output is correct
7 Incorrect 1 ms 1056 KB Wrong Answer [5]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 11140 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 11140 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -