제출 #829814

#제출 시각아이디문제언어결과실행 시간메모리
829814birthdaycakeStray Cat (JOI20_stray)C++17
4 / 100
46 ms22440 KiB
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std; 

vector<int>adj[200001];
int depth[200001],col[200001];
int vs[200001];

void dfs(int x){
  vs[x] = 1;
  for(auto s: adj[x]){
    if(!vs[s]) {
      depth[s] = depth[x] + 1;
      dfs(s); 
    }
  }
}

vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
  for(int i = 1; i <= N; i++) {
    adj[i].clear();
    depth[i] = vs[i] = 0; 
  }
  for(int i = 0; i < M; i++){
    adj[U[i]].push_back(V[i]);
    adj[V[i]].push_back(U[i]);
  }
  dfs(0); 
  vector<int>ans; 
  for(int i = 0; i < M; i++){
    ans.push_back(max(depth[U[i]], depth[V[i]]) % 3); 
  }
  return ans; 
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std; 
int a,b;
void Init(int A, int B) {
  a = A;
  b = B;
}

int Move(vector<int> y) {
  set<int>p;
  int col = 0;
  for(auto s: y) {
    if(s > 0) p.insert(col);
    col++;
  }
  auto xx = *p.begin(); 
  p.erase(p.begin()); 
  if(p.empty()) return xx; 
  if(xx == 0 and *p.begin() == 1) return 0; 
  if(xx == 1 and *p.begin() == 2) return 1; 
  if(xx == 0 and *p.begin() == 2) return 2; 
  return -1;
}
#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...