Submission #1000664

#TimeUsernameProblemLanguageResultExecution timeMemory
1000664Unforgettablepl길고양이 (JOI20_stray)C++17
15 / 100
40 ms16844 KiB
#include <bits/stdc++.h>
using namespace std;

namespace {


vector<int> strat1(int N, int M, int A, int B,
                vector<int> U, std::vector<int> V) {
    // General Graph A=3
    vector<int> ans(M,-1);
    vector<vector<pair<int,int>>> adj(N);
    for(int i=0;i<M;i++){
        adj[U[i]].emplace_back(V[i],i);
        adj[V[i]].emplace_back(U[i],i);
    }
    vector<bool> visited(N);
    queue<pair<int,int>> q;
    q.emplace(0,0);
    while(!q.empty()){
        auto [idx,col] = q.front();q.pop();
        if(visited[idx])continue;
        visited[idx]=true;
        for(auto&i:adj[idx]){
            if(ans[i.second]==-1)ans[i.second]=col;
            if(!visited[i.first])q.emplace(i.first,(col+1)%3);
        }
    }
    return ans;
}

vector<int> strat2(int N, int M, int A, int B,
                vector<int> U, std::vector<int> V) {
    // Tree A=2,B=6
    return {};
}

}  // namespace

std::vector<int> Mark(int N, int M, int A, int B,
                vector<int> U, std::vector<int> V) {
    if(A>=3)return strat1(N,M,A,B,U,V);
    else return strat2(N,M,A,B,U,V);
}
#include <bits/stdc++.h>
using namespace std;

namespace {

int A, B;
int strat1(vector<int> y) {
    // General Graph A=3
    bool more0 = y[0]>0;
    bool more1 = y[1]>0;
    bool more2 = y[2]>0;
    if(more0 and more1)return 0;
    if(more1 and more2)return 1;
    if(more2 and more0)return 2;
    if(more0)return 0;
    if(more1)return 1;
    if(more2)return 2;
}

int strat2(vector<int> y) {
    // Tree A=2,B=6
    return -1;
}

}  // namespace

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

int Move(vector<int> y) {
    if(A>=3)return strat1(y);
    else return strat2(y);
}

Compilation message (stderr)

Catherine.cpp: In function 'int {anonymous}::strat1(std::vector<int>)':
Catherine.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...