Submission #260918

# Submission time Handle Problem Language Result Execution time Memory
260918 2020-08-11T07:50:04 Z 임성재(#5066) Stray Cat (JOI20_stray) C++17
0 / 100
26 ms 14176 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]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 14072 KB Program didn't exit properly, or you printed something to stdout.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 14072 KB Program didn't exit properly, or you printed something to stdout.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 14072 KB Program didn't exit properly, or you printed something to stdout.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 14072 KB Program didn't exit properly, or you printed something to stdout.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 10240 KB Program didn't exit properly, or you printed something to stdout.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 14176 KB Program didn't exit properly, or you printed something to stdout.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 14176 KB Program didn't exit properly, or you printed something to stdout.
2 Halted 0 ms 0 KB -