답안 #260919

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260919 2020-08-11T07:51:15 Z 임성재(#5066) 길고양이 (JOI20_stray) C++17
5 / 100
60 ms 19932 KB
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

namespace {

vector<int> g[200010];
int d[200010] = {};
int num[200010] = {};
int ret[200010] = {};
int tb[6] = {1, 1, 0, 1, 0, 0};
int p[200010] = {};

}  // namespace

std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::vector<int> V) {
  
  for(int i=0; i<M; i++) g[U[i]].eb(V[i]), g[V[i]].eb(U[i]);

  queue<int> q;

  q.em(0);
  d[0] = 1;

  vector<int> v;
  while(q.size()) {
    int x = q.front();
    q.pop();
    v.eb(x);

    for(auto i : g[x]) {
      if(d[i]) continue;

      if(x != 0 && g[x].size() == 2) {
        num[i] = (num[x] + 1) % 6;
      }
      else num[i] = 6;

      if(num[i] == 6) ret[i] = 1 - ret[x];
      //else if(g[i].size() == 3) ret[i] = 0;
      else ret[i] = tb[num[i]];
    
      p[i] = x;
      d[i] = d[x] + 1;
      q.em(i);
    }
  } 

  std::vector<int> X(M);
  for (int i = 0; i < M; ++i) {
    if(p[U[i]] == V[i]) X[i] = ret[U[i]];
    else X[i] = ret[V[i]];

    //cout << X[i];
  }
  //cout << endl;
  return X;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

namespace {

int last = 1;
int cnt = 0;
int a, b;
int chk[5];

}  // namespace

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

int Move(std::vector<int> y) {
  //cout << y[0] << " " << y[1] << " " << cnt << " " << last << endl;

  if(!y[0] && !y[1]) return -1;
  if(y[0] > y[1] && y[1] == 1) return last = 1;
  if(y[1] > y[0] && y[0] == 1) return last = 0;
  if(y[0] > 2) return -1;
  if(y[1] > 2) return -1;

  if(y[0] + y[1] == 1) {
    cnt++;

    if(y[0]) last = 0;
    else last = 1;
    if(cnt >= 0) chk[cnt+1] = last;

    if(last == -1) cnt = -1;

    if(cnt == 3) {
      cnt = -inf;
      int x = chk[0]*16 + chk[1]*8 + chk[2]*4 + chk[3]*2 + chk[4];

      if(x == 26 || x == 20 || x == 9 || x == 19 || x == 6 || x == 13) {
        last = chk[3];
        //cout << x << " !back\n";
        return -1;
      }

      //cout << x << " go\n";
      return last;
    }

    return last;
  }
  if(y[0] == 1 && y[1] == 1) {
    cnt = 0;

    chk[0] = last;
    chk[1] = 1 - last;

    return last = 1 - last;
  }
  if(y[0] == 2) {
    cnt = 0;

    chk[0] = 0;
    chk[1] = 0;
    return last = 0;
  }
  if(y[1] == 2) {
    cnt = 0;

    chk[0] = 1;
    chk[1] = 1;
    return last = 1;
  }
}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:89:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 19932 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 49 ms 19932 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 17656 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 17656 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 10240 KB Output is correct
2 Correct 4 ms 9984 KB Output is correct
3 Correct 6 ms 10240 KB Output is correct
4 Correct 5 ms 10240 KB Output is correct
5 Correct 5 ms 10240 KB Output is correct
6 Correct 5 ms 10240 KB Output is correct
7 Correct 5 ms 10240 KB Output is correct
8 Correct 5 ms 10240 KB Output is correct
9 Correct 5 ms 10240 KB Output is correct
10 Correct 5 ms 10240 KB Output is correct
11 Correct 5 ms 10240 KB Output is correct
12 Correct 5 ms 10240 KB Output is correct
13 Correct 5 ms 10240 KB Output is correct
14 Correct 5 ms 10240 KB Output is correct
15 Correct 5 ms 10240 KB Output is correct
16 Correct 5 ms 10240 KB Output is correct
17 Correct 5 ms 10240 KB Output is correct
18 Correct 5 ms 10240 KB Output is correct
19 Correct 5 ms 10240 KB Output is correct
20 Correct 6 ms 10240 KB Output is correct
21 Correct 5 ms 10240 KB Output is correct
22 Correct 5 ms 10240 KB Output is correct
23 Correct 5 ms 10240 KB Output is correct
24 Correct 5 ms 10240 KB Output is correct
25 Correct 5 ms 10240 KB Output is correct
26 Correct 5 ms 10240 KB Output is correct
27 Correct 5 ms 10240 KB Output is correct
28 Correct 5 ms 10240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 15844 KB Output is correct
2 Incorrect 50 ms 16452 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 15964 KB Output is correct
2 Incorrect 51 ms 16464 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -