답안 #648065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
648065 2022-10-05T09:08:18 Z beaconmc 길고양이 (JOI20_stray) C++14
5 / 100
52 ms 17288 KB
#include "Anthony.h"

#include <bits/stdc++.h>

typedef int ll;
using namespace std;


#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

namespace{}


vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
  vector<ll> pat = {1,0,1,1,0,0};

  vector<vector<int>> edges[N];
  FOR(i,0,M){
    edges[U[i]].push_back({V[i],i});
    edges[V[i]].push_back({U[i],i});
  }
  bool visited[N];
  FOR(i,0,N) visited[i] = false;


  vector<int> x(N);
  vector<int> ans(M);
  FOR(i,0,N) x[i] = 0;
  queue<vector<int>> q;
  visited[0] = true;

  q.push({0,0});
  while (q.size()){
    vector<int> node = q.front();
    q.pop();

    for (auto&i : edges[node[0]]){
      if (edges[node[0]].size() == 2){
        if (!visited[i[0]]){
          visited[i[0]] = true;
          ans[i[1]] = pat[node[1]%6];
          q.push({i[0], node[1]+1});
        }
      }else{
        if (!visited[i[0]]){
          visited[i[0]] = true;
          ll cur = -1;
          if (pat[(node[1]-1+6)%6]==0){
            cur = 0;
          }else{
            cur = 5;
          }

          ans[i[1]] = pat[cur%6];
          q.push({i[0], cur+1});

        }

      }

    }

  }

  // for (auto&i : ans){
  //   cout << i << endl;
  // }
  return ans;


}
#include "Catherine.h"
#include <bits/stdc++.h>

typedef int ll;
using namespace std;


#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

namespace {

int A, B;
ll choice,moved,last;
bool up,init;
vector<ll> stuff;
set<vector<ll>> down;

}  // namespace

void Init(int A, int B) {
  ::A = A;
  ::B = B;
  choice = 0;
  moved = 0;
  last = 0;

  up = false;
  init = false;

  down = {
    {1,0,1,1,0,0},
    {0,1,1,0,0,1},
    {1,1,0,0,1,0},
    {1,0,0,1,0,1},
    {0,0,1,0,1,1},
    {0,1,0,1,1,0}
  };

}


int Move(std::vector<int> y) {
  //cout << y[0] << " " << y[1] << " " << up << endl;
  if (!init){
    init = true;
    if (y[0]+y[1] == 2){
      

      if (y[0]>0){
        last = 0;stuff.push_back(0);
        return 0;
      } else{
        last = 1;stuff.push_back(1);
        return 1;
      } 

    }else{
      up = true;

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

    }
  }

  if (!up){
    if (stuff.size()==6){
      if (down.count(stuff)){
        up = true;
        return -1;
      }

      else{
        up = true;
      }

    }
    else{

      if (y[0]+y[1]==1){
        if (y[0]){
          last = 0;stuff.push_back(0);return 0;
        }
        else{
          last = 1;stuff.push_back(1);return 1;
        }
      }
      else{
        up = true;
        if (y[1-last]){
          last = 1-last;
          return last;
        }else{
          return -1;
        }
      }
    }

  }
  if (up){

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







  // if (!y[0] && y[1] && y[2]){
  //   return 1;
  // }
  // if (y[0] && !y[1] && y[2]){
  //   return 2;
  // }
  // if (y[0] && y[1] && !y[2]){
  //   return 0;

  // }
  // if (y[0] && !y[1] && !y[2]){
  //   return 0;
  // }
  // if (!y[0] && y[1] && !y[2]){
  //   return 1;
  // }
  // if (!y[0] && !y[1] && y[2]){
  //   return 2;
  // }

}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:146:1: warning: control reaches end of non-void function [-Wreturn-type]
  146 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 17288 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 17288 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 15148 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 32 ms 14896 KB Output is correct
4 Correct 52 ms 16068 KB Output is correct
5 Correct 48 ms 16176 KB Output is correct
6 Correct 45 ms 15092 KB Output is correct
7 Incorrect 36 ms 15176 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 15148 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 32 ms 14896 KB Output is correct
4 Correct 52 ms 16068 KB Output is correct
5 Correct 48 ms 16176 KB Output is correct
6 Correct 45 ms 15092 KB Output is correct
7 Incorrect 36 ms 15176 KB Wrong Answer [6]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 864 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 2 ms 900 KB Output is correct
4 Correct 2 ms 908 KB Output is correct
5 Correct 2 ms 876 KB Output is correct
6 Correct 2 ms 908 KB Output is correct
7 Correct 2 ms 900 KB Output is correct
8 Correct 2 ms 900 KB Output is correct
9 Correct 2 ms 864 KB Output is correct
10 Correct 2 ms 920 KB Output is correct
11 Correct 2 ms 908 KB Output is correct
12 Correct 2 ms 900 KB Output is correct
13 Correct 2 ms 900 KB Output is correct
14 Correct 2 ms 908 KB Output is correct
15 Correct 2 ms 908 KB Output is correct
16 Correct 2 ms 868 KB Output is correct
17 Correct 2 ms 900 KB Output is correct
18 Correct 2 ms 868 KB Output is correct
19 Correct 2 ms 900 KB Output is correct
20 Correct 2 ms 908 KB Output is correct
21 Correct 2 ms 864 KB Output is correct
22 Correct 2 ms 848 KB Output is correct
23 Correct 2 ms 900 KB Output is correct
24 Correct 2 ms 900 KB Output is correct
25 Correct 2 ms 908 KB Output is correct
26 Correct 2 ms 908 KB Output is correct
27 Correct 2 ms 900 KB Output is correct
28 Correct 2 ms 908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 13616 KB Output is correct
2 Incorrect 35 ms 13616 KB Wrong Answer [5]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 13572 KB Output is correct
2 Correct 40 ms 13788 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 31 ms 13636 KB Output is correct
5 Correct 47 ms 14628 KB Output is correct
6 Correct 46 ms 14560 KB Output is correct
7 Correct 40 ms 13680 KB Output is correct
8 Correct 37 ms 13696 KB Output is correct
9 Correct 46 ms 14568 KB Output is correct
10 Correct 49 ms 14676 KB Output is correct
11 Correct 48 ms 14564 KB Output is correct
12 Correct 49 ms 14568 KB Output is correct
13 Correct 49 ms 14552 KB Output is correct
14 Correct 51 ms 14696 KB Output is correct
15 Incorrect 44 ms 14592 KB Wrong Answer [6]
16 Halted 0 ms 0 KB -