Submission #388316

# Submission time Handle Problem Language Result Execution time Memory
388316 2021-04-10T22:30:33 Z ngrace Stray Cat (JOI20_stray) C++14
4 / 100
64 ms 16236 KB
#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {

int FunctionExample(int i, int A) {
  return i % A;
}

}  // namespace

std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::vector<int> V) {
  std::vector<int> X(M,-1);

  vector<vector<pair<int,int>>> adj(N,vector<pair<int,int>>(0));//node,index of road
  for(int i=0;i<M;i++){
    adj[U[i]].push_back({V[i],i});
    adj[V[i]].push_back({U[i],i});
  }

  if(A==4 || A==3){
    vector<int> dists(N,-1);
    dists[0]=0;
    queue<int> q;
    q.push(0);

    while(q.size()>0){
      int cur=q.front();
      q.pop();
      for(pair<int,int>& it:adj[cur]){
        if(dists[it.first]==-1){
          dists[it.first]=dists[cur]+1;
          X[it.second]=dists[cur]%3;
          q.push(it.first);
        }
      }
    }

    for(int i=0;i<M;i++){
      if(X[i]==-1){
        vector<int> cur(3,0);
        vector<int> cur1(3,0);
        for(pair<int,int>& it:adj[U[i]]){
          if(X[it.second]!=-1){
            cur[X[it.second]]=1;
          }
        }
        for(pair<int,int>& it:adj[V[i]]){
          if(X[it.second]!=-1){
            cur1[X[it.second]]=1;
          }
        }

        vector<int> a = cur;
        for(int p=0;p<3;p++){
          if(cur1[p]==1){
            a[p]++;
          }
        }
        
        if(a[0]>0 && a[1]>0 && a[2]>0){
          if(a[0]==2){
            X[i]=0;
          }
          else if(a[1]==2){
            X[i]=1;
          }
          else{
            X[i]=2;
          }
        }
        if(a[0]==0){
          X[i]=2;
        }
        if(a[1]==0){
          X[i]=0;
        }
        if(a[2]==0){
          X[i]=1;
          if(a[0]==0){
            X[i]=2;
          }
        }
      }
    }
  }

  /**for(int&it:X){
    cout<<it<<" ";
  }
  cout<<endl;**/

  return X;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace {

int A, B, out;
int variable_example = 0;
vector<int> cur;
vector<int> pastMoves;

}  // namespace

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

int Move(std::vector<int> y) {
  out=0;
  cur = vector<int>(4,0);
  if(A==4 || A==3){
    if(pastMoves.size()>0){
      y[pastMoves.back()]++;
    }
    for(int i=0;i<y.size();i++){
      if(y[i]>0){
        cur[i]=1;
      }
    }
    
    if(cur[0]==1 && cur[1]==1){
      out=0;
    }
    else if(cur[1]==1&&cur[2]==1){
      out=1;
    }
    else if(cur[2]==1&&cur[0]==1){
      out=2;
    }
    else if(cur[0]==1){
      out=0;
    }
    else if(cur[1]==1){
      out=1;
    }
    else{
      out=2;
    }
  }
  
  pastMoves.push_back(out);
  return out;
}

Compilation message

Anthony.cpp:7:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
    7 | int FunctionExample(int i, int A) {
      |     ^~~~~~~~~~~~~~~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=0;i<y.size();i++){
      |                 ~^~~~~~~~~
Catherine.cpp: At global scope:
Catherine.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 50 ms 14924 KB Output is correct
2 Correct 0 ms 488 KB Output is correct
3 Correct 38 ms 14296 KB Output is correct
4 Correct 64 ms 16236 KB Output is correct
5 Correct 55 ms 16140 KB Output is correct
6 Correct 43 ms 14856 KB Output is correct
7 Correct 45 ms 14752 KB Output is correct
8 Correct 49 ms 15512 KB Output is correct
9 Correct 54 ms 15716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 14924 KB Output is correct
2 Correct 0 ms 488 KB Output is correct
3 Correct 38 ms 14296 KB Output is correct
4 Correct 64 ms 16236 KB Output is correct
5 Correct 55 ms 16140 KB Output is correct
6 Correct 43 ms 14856 KB Output is correct
7 Correct 45 ms 14752 KB Output is correct
8 Correct 49 ms 15512 KB Output is correct
9 Correct 54 ms 15716 KB Output is correct
10 Correct 40 ms 12856 KB Output is correct
11 Correct 39 ms 12968 KB Output is correct
12 Correct 40 ms 12736 KB Output is correct
13 Correct 45 ms 12664 KB Output is correct
14 Incorrect 39 ms 13160 KB Wrong Answer [6]
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 12720 KB Output is correct
2 Correct 1 ms 496 KB Output is correct
3 Correct 34 ms 12260 KB Output is correct
4 Correct 51 ms 13960 KB Output is correct
5 Correct 52 ms 14020 KB Output is correct
6 Correct 44 ms 12676 KB Output is correct
7 Correct 40 ms 12696 KB Output is correct
8 Correct 48 ms 13320 KB Output is correct
9 Correct 49 ms 13200 KB Output is correct
10 Correct 45 ms 13056 KB Output is correct
11 Correct 45 ms 13084 KB Output is correct
12 Correct 47 ms 12984 KB Output is correct
13 Correct 44 ms 13068 KB Output is correct
14 Correct 50 ms 13328 KB Output is correct
15 Correct 49 ms 13360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 12720 KB Output is correct
2 Correct 1 ms 496 KB Output is correct
3 Correct 34 ms 12260 KB Output is correct
4 Correct 51 ms 13960 KB Output is correct
5 Correct 52 ms 14020 KB Output is correct
6 Correct 44 ms 12676 KB Output is correct
7 Correct 40 ms 12696 KB Output is correct
8 Correct 48 ms 13320 KB Output is correct
9 Correct 49 ms 13200 KB Output is correct
10 Correct 45 ms 13056 KB Output is correct
11 Correct 45 ms 13084 KB Output is correct
12 Correct 47 ms 12984 KB Output is correct
13 Correct 44 ms 13068 KB Output is correct
14 Correct 50 ms 13328 KB Output is correct
15 Correct 49 ms 13360 KB Output is correct
16 Correct 37 ms 11036 KB Output is correct
17 Correct 38 ms 11520 KB Output is correct
18 Correct 44 ms 11356 KB Output is correct
19 Correct 39 ms 11400 KB Output is correct
20 Incorrect 45 ms 11724 KB Wrong Answer [6]
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 488 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 2168 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 2168 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -