답안 #911190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
911190 2024-01-18T15:07:10 Z winter0101 길고양이 (JOI20_stray) C++14
6 / 100
42 ms 16972 KB
#include<bits/stdc++.h>
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
const int maxn=2e4+9;
vector<int>a[maxn];
bool vis[maxn];
int d[maxn];
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);
  int n=N,m=M;
  for1(i,0,m-1){
  a[U[i]].pb(V[i]);
  a[V[i]].pb(U[i]);
  }
  vis[0]=1;
  queue<int>t;
  t.push(0);
  while (!t.empty()){
  auto u=t.front();
  t.pop();
  for (auto v:a[u]){
  if (vis[v])continue;
  d[v]=d[u]+1;
  t.push(v);
  vis[v]=1;
  }
  }
  for (int i = 0; i < M; ++i) {
  int u=U[i],v=V[i];
  if (d[u]==d[v]){
  x[i]=3;
  continue;
  }
  if (d[u]>d[v])swap(u,v);
  int mask=0;
  if (d[u]%3==2||d[v]%3==2)mask|=(1<<1);
  if (d[u]%3==1||d[v]%3==1)mask|=(1<<0);
  x[i]=mask-1;
  }
  return x;
}
#include<bits/stdc++.h>
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
namespace {

int A, B;
int variable_example = 0;

}  // namespace

void Init(int A, int B) {
  ::A = A;
  ::B = B;
}
int cnt[3];
int Move(std::vector<int> y) {
  int ct=0;
  for1(i,0,2){
  if (y[i]!=0)ct++;
  }
  if (ct==1){
  for1(i,0,2){
  if (y[i]!=0)return i;
  }
  }
  for1(i,0,2)cnt[i]=0;
  for1(i,0,2){
  if (y[i]!=0){
  int j=i+1;
  for1(k,0,1){
  if (j>>k&1){
  cnt[(1<<k)]++;
  }
  else {
  cnt[0]++;
  }
  }
  }
  }
  for1(i,0,2){
  if (cnt[i]==2){
  int ans=i;
  int gg=(i-1+3)%3;
  ans+=gg;
  return ans-1;
  }
  }
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:23:7: warning: unused variable 'n' [-Wunused-variable]
   23 |   int n=N,m=M;
      |       ^

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
   61 | }
      | ^
Catherine.cpp: At global scope:
Catherine.cpp:20:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   20 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 15920 KB Output is correct
2 Correct 1 ms 1296 KB Output is correct
3 Correct 26 ms 15480 KB Output is correct
4 Correct 41 ms 16972 KB Output is correct
5 Correct 42 ms 16948 KB Output is correct
6 Correct 30 ms 15624 KB Output is correct
7 Correct 34 ms 15672 KB Output is correct
8 Correct 34 ms 16368 KB Output is correct
9 Correct 40 ms 16460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 15920 KB Output is correct
2 Correct 1 ms 1296 KB Output is correct
3 Correct 26 ms 15480 KB Output is correct
4 Correct 41 ms 16972 KB Output is correct
5 Correct 42 ms 16948 KB Output is correct
6 Correct 30 ms 15624 KB Output is correct
7 Correct 34 ms 15672 KB Output is correct
8 Correct 34 ms 16368 KB Output is correct
9 Correct 40 ms 16460 KB Output is correct
10 Correct 26 ms 13900 KB Output is correct
11 Correct 27 ms 13896 KB Output is correct
12 Correct 26 ms 13928 KB Output is correct
13 Correct 26 ms 13964 KB Output is correct
14 Correct 27 ms 14152 KB Output is correct
15 Correct 38 ms 14540 KB Output is correct
16 Correct 33 ms 16528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 13460 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 24 ms 13108 KB Output is correct
4 Correct 41 ms 14844 KB Output is correct
5 Correct 36 ms 14920 KB Output is correct
6 Correct 30 ms 13636 KB Output is correct
7 Correct 35 ms 13456 KB Output is correct
8 Correct 33 ms 14220 KB Output is correct
9 Correct 35 ms 14116 KB Output is correct
10 Correct 30 ms 13736 KB Output is correct
11 Correct 30 ms 13912 KB Output is correct
12 Correct 32 ms 13900 KB Output is correct
13 Correct 30 ms 13892 KB Output is correct
14 Correct 35 ms 14088 KB Output is correct
15 Correct 34 ms 14184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 13460 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 24 ms 13108 KB Output is correct
4 Correct 41 ms 14844 KB Output is correct
5 Correct 36 ms 14920 KB Output is correct
6 Correct 30 ms 13636 KB Output is correct
7 Correct 35 ms 13456 KB Output is correct
8 Correct 33 ms 14220 KB Output is correct
9 Correct 35 ms 14116 KB Output is correct
10 Correct 30 ms 13736 KB Output is correct
11 Correct 30 ms 13912 KB Output is correct
12 Correct 32 ms 13900 KB Output is correct
13 Correct 30 ms 13892 KB Output is correct
14 Correct 35 ms 14088 KB Output is correct
15 Correct 34 ms 14184 KB Output is correct
16 Incorrect 6 ms 2796 KB Wrong Answer [2]
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1312 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2796 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2828 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -