Submission #648077

# Submission time Handle Problem Language Result Execution time Memory
648077 2022-10-05T09:56:20 Z beaconmc Stray Cat (JOI20_stray) C++14
91 / 100
57 ms 16996 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) {
  if (A>2){

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


  vector<int> x(N);
  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();
    x[node[0]] = node[1];
    for (auto&i : edges[node[0]]){
      if (!visited[i]){
        visited[i] = true;
        q.push({i, node[1]+1});
      }
    }
  }
  vector<int> ans(M);
  FOR(i,0,M){
    ans[i] = (min(x[U[i]], x[V[i]])%3);
  }



  return ans;
  }

  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) {
  if (A>2){
      
    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;
    }
  }
  //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]==1){
          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:169:1: warning: control reaches end of non-void function [-Wreturn-type]
  169 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 39 ms 15304 KB Output is correct
2 Correct 1 ms 524 KB Output is correct
3 Correct 34 ms 16044 KB Output is correct
4 Correct 53 ms 16800 KB Output is correct
5 Correct 55 ms 16996 KB Output is correct
6 Correct 37 ms 15688 KB Output is correct
7 Correct 40 ms 15608 KB Output is correct
8 Correct 44 ms 16252 KB Output is correct
9 Correct 52 ms 16244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 15304 KB Output is correct
2 Correct 1 ms 524 KB Output is correct
3 Correct 34 ms 16044 KB Output is correct
4 Correct 53 ms 16800 KB Output is correct
5 Correct 55 ms 16996 KB Output is correct
6 Correct 37 ms 15688 KB Output is correct
7 Correct 40 ms 15608 KB Output is correct
8 Correct 44 ms 16252 KB Output is correct
9 Correct 52 ms 16244 KB Output is correct
10 Correct 42 ms 13748 KB Output is correct
11 Correct 34 ms 13784 KB Output is correct
12 Correct 33 ms 13624 KB Output is correct
13 Correct 39 ms 13560 KB Output is correct
14 Correct 49 ms 13780 KB Output is correct
15 Correct 38 ms 14152 KB Output is correct
16 Correct 44 ms 16396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 13008 KB Output is correct
2 Correct 2 ms 516 KB Output is correct
3 Correct 38 ms 13052 KB Output is correct
4 Correct 49 ms 14220 KB Output is correct
5 Correct 44 ms 14212 KB Output is correct
6 Correct 36 ms 12996 KB Output is correct
7 Correct 36 ms 13024 KB Output is correct
8 Correct 43 ms 14052 KB Output is correct
9 Correct 47 ms 13884 KB Output is correct
10 Correct 37 ms 13812 KB Output is correct
11 Correct 40 ms 13768 KB Output is correct
12 Correct 39 ms 13740 KB Output is correct
13 Correct 38 ms 13716 KB Output is correct
14 Correct 44 ms 14056 KB Output is correct
15 Correct 44 ms 14000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 13008 KB Output is correct
2 Correct 2 ms 516 KB Output is correct
3 Correct 38 ms 13052 KB Output is correct
4 Correct 49 ms 14220 KB Output is correct
5 Correct 44 ms 14212 KB Output is correct
6 Correct 36 ms 12996 KB Output is correct
7 Correct 36 ms 13024 KB Output is correct
8 Correct 43 ms 14052 KB Output is correct
9 Correct 47 ms 13884 KB Output is correct
10 Correct 37 ms 13812 KB Output is correct
11 Correct 40 ms 13768 KB Output is correct
12 Correct 39 ms 13740 KB Output is correct
13 Correct 38 ms 13716 KB Output is correct
14 Correct 44 ms 14056 KB Output is correct
15 Correct 44 ms 14000 KB Output is correct
16 Correct 36 ms 12120 KB Output is correct
17 Correct 39 ms 11992 KB Output is correct
18 Correct 34 ms 11648 KB Output is correct
19 Correct 35 ms 11748 KB Output is correct
20 Correct 40 ms 12320 KB Output is correct
21 Correct 34 ms 12008 KB Output is correct
22 Correct 42 ms 14196 KB Output is correct
23 Correct 34 ms 11800 KB Output is correct
24 Correct 41 ms 11712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 896 KB Output is correct
2 Correct 0 ms 508 KB Output is correct
3 Correct 2 ms 896 KB Output is correct
4 Correct 2 ms 904 KB Output is correct
5 Correct 2 ms 904 KB Output is correct
6 Correct 2 ms 896 KB Output is correct
7 Correct 3 ms 896 KB Output is correct
8 Correct 2 ms 904 KB Output is correct
9 Correct 2 ms 896 KB Output is correct
10 Correct 2 ms 904 KB Output is correct
11 Correct 2 ms 904 KB Output is correct
12 Correct 2 ms 896 KB Output is correct
13 Correct 2 ms 896 KB Output is correct
14 Correct 2 ms 896 KB Output is correct
15 Correct 2 ms 896 KB Output is correct
16 Correct 2 ms 896 KB Output is correct
17 Correct 2 ms 908 KB Output is correct
18 Correct 2 ms 896 KB Output is correct
19 Correct 2 ms 896 KB Output is correct
20 Correct 2 ms 904 KB Output is correct
21 Correct 2 ms 896 KB Output is correct
22 Correct 2 ms 904 KB Output is correct
23 Correct 2 ms 904 KB Output is correct
24 Correct 2 ms 904 KB Output is correct
25 Correct 2 ms 896 KB Output is correct
26 Correct 2 ms 896 KB Output is correct
27 Correct 2 ms 892 KB Output is correct
28 Correct 2 ms 908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 13028 KB Output is correct
2 Correct 45 ms 13424 KB Output is correct
3 Correct 0 ms 508 KB Output is correct
4 Correct 37 ms 13376 KB Output is correct
5 Correct 56 ms 14056 KB Output is correct
6 Correct 52 ms 14200 KB Output is correct
7 Correct 41 ms 13208 KB Output is correct
8 Correct 38 ms 13232 KB Output is correct
9 Correct 52 ms 14116 KB Output is correct
10 Correct 56 ms 14316 KB Output is correct
11 Correct 44 ms 14136 KB Output is correct
12 Correct 47 ms 14156 KB Output is correct
13 Correct 44 ms 14116 KB Output is correct
14 Correct 50 ms 14124 KB Output is correct
15 Correct 57 ms 14120 KB Output is correct
16 Correct 43 ms 14216 KB Output is correct
17 Correct 48 ms 13836 KB Output is correct
18 Correct 48 ms 13820 KB Output is correct
19 Correct 42 ms 13924 KB Output is correct
20 Correct 48 ms 13812 KB Output is correct
21 Correct 51 ms 13928 KB Output is correct
22 Correct 43 ms 13848 KB Output is correct
23 Correct 37 ms 13048 KB Output is correct
24 Correct 39 ms 13084 KB Output is correct
25 Correct 41 ms 13232 KB Output is correct
26 Correct 52 ms 13124 KB Output is correct
27 Correct 43 ms 13700 KB Output is correct
28 Correct 47 ms 13612 KB Output is correct
29 Correct 43 ms 13732 KB Output is correct
30 Correct 42 ms 13684 KB Output is correct
31 Correct 48 ms 13068 KB Output is correct
32 Correct 43 ms 13088 KB Output is correct
33 Correct 38 ms 13236 KB Output is correct
34 Correct 40 ms 13156 KB Output is correct
35 Correct 43 ms 13628 KB Output is correct
36 Correct 49 ms 13540 KB Output is correct
37 Correct 53 ms 13540 KB Output is correct
38 Correct 43 ms 13520 KB Output is correct
39 Correct 44 ms 13564 KB Output is correct
40 Correct 45 ms 13540 KB Output is correct
41 Correct 49 ms 13736 KB Output is correct
42 Correct 43 ms 13768 KB Output is correct
43 Correct 44 ms 13820 KB Output is correct
44 Correct 44 ms 13904 KB Output is correct
45 Correct 46 ms 13872 KB Output is correct
46 Correct 44 ms 13904 KB Output is correct
47 Correct 40 ms 13432 KB Output is correct
48 Correct 51 ms 13408 KB Output is correct
49 Correct 39 ms 13344 KB Output is correct
50 Correct 44 ms 13516 KB Output is correct
51 Correct 43 ms 13380 KB Output is correct
52 Correct 39 ms 13336 KB Output is correct
53 Correct 38 ms 13296 KB Output is correct
54 Correct 39 ms 13384 KB Output is correct
55 Correct 43 ms 13376 KB Output is correct
56 Correct 43 ms 13380 KB Output is correct
57 Correct 41 ms 13420 KB Output is correct
58 Correct 41 ms 13324 KB Output is correct
59 Correct 41 ms 13196 KB Output is correct
60 Correct 44 ms 13256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 13104 KB Output is correct
2 Correct 43 ms 13300 KB Output is correct
3 Correct 1 ms 508 KB Output is correct
4 Correct 35 ms 13212 KB Output is correct
5 Correct 47 ms 14164 KB Output is correct
6 Correct 46 ms 14136 KB Output is correct
7 Correct 39 ms 13236 KB Output is correct
8 Correct 43 ms 13324 KB Output is correct
9 Correct 53 ms 14120 KB Output is correct
10 Correct 48 ms 14060 KB Output is correct
11 Correct 46 ms 14200 KB Output is correct
12 Correct 47 ms 14100 KB Output is correct
13 Correct 49 ms 14104 KB Output is correct
14 Correct 49 ms 14244 KB Output is correct
15 Incorrect 44 ms 14096 KB Wrong Answer [6]
16 Halted 0 ms 0 KB -