답안 #829894

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829894 2023-08-18T15:38:18 Z Rifal 길고양이 (JOI20_stray) C++14
15 / 100
45 ms 16600 KB
#include<bits/stdc++.h>
#include "Anthony.h"
#include <vector>
using namespace std;
namespace {
    const int Max = 2e4 + 5;
    vector<int> v[Max];
    int level[Max];
    void bfs(int s) {
        queue<int> q;
        q.push(s); level[s] = 1;
        while(!q.empty()) {
            int fron = q.front(); q.pop();
            for(auto i : v[fron]) {
                if(level[i] == 0) {
                    level[i] = level[fron] + 1;
                    q.push(i);
                }
                else if(level[i] > level[fron]+1){
                    level[i] = level[fron] + 1;
                    q.push(i);
                }
            }
        }
    }
}

vector<int> Mark(int N, int M, int A, int B,
                      vector<int> U, vector<int> V) {
    vector<int> x;
    for(int i = 0; i < M; i++) {
        v[U[i]].push_back(V[i]);
        v[V[i]].push_back(U[i]);
    }
    bfs(0);
    for(int i = 0; i < M; i++) {
        int a = min(level[U[i]]%3,level[V[i]]%3), b = max(level[U[i]]%3,level[V[i]]%3);
        if(a == 1 && b == 2) x.push_back(1);
        else if(a == 0 && b == 2) x.push_back(2);
        else if(a == 0 && b == 1) x.push_back(0);
        else if(a == b) x.push_back(a);
    }


  return x;
}
#include "Catherine.h"
#include <vector>

using namespace std;
namespace {

int A, B;
int variable_example = 0;

}  // namespace

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

int Move(vector<int> y) {
  ++variable_example; int a = 10, b = -1;
  for (int i = 0; i < A; ++i) {
      if(y[i] != 0) {
        a = min(a,i);
        b = max(b,i);
      }
  }
  if(a == 0 && b == 1) return 0;
  else if(a == 1 && b == 2) return 1;
  else if(a == 0 && b == 2) return 2;
  else if(a == b) return a;


}

Compilation message

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 15384 KB Output is correct
2 Correct 0 ms 1024 KB Output is correct
3 Correct 26 ms 14752 KB Output is correct
4 Correct 34 ms 16516 KB Output is correct
5 Correct 34 ms 16508 KB Output is correct
6 Correct 30 ms 15328 KB Output is correct
7 Correct 28 ms 15148 KB Output is correct
8 Correct 34 ms 15904 KB Output is correct
9 Correct 40 ms 15864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 15384 KB Output is correct
2 Correct 0 ms 1024 KB Output is correct
3 Correct 26 ms 14752 KB Output is correct
4 Correct 34 ms 16516 KB Output is correct
5 Correct 34 ms 16508 KB Output is correct
6 Correct 30 ms 15328 KB Output is correct
7 Correct 28 ms 15148 KB Output is correct
8 Correct 34 ms 15904 KB Output is correct
9 Correct 40 ms 15864 KB Output is correct
10 Correct 32 ms 13240 KB Output is correct
11 Correct 28 ms 13736 KB Output is correct
12 Correct 27 ms 13744 KB Output is correct
13 Correct 27 ms 13608 KB Output is correct
14 Correct 31 ms 13928 KB Output is correct
15 Correct 28 ms 14412 KB Output is correct
16 Correct 33 ms 16600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 13036 KB Output is correct
2 Correct 0 ms 1032 KB Output is correct
3 Correct 26 ms 12584 KB Output is correct
4 Correct 40 ms 14428 KB Output is correct
5 Correct 44 ms 14364 KB Output is correct
6 Correct 27 ms 13040 KB Output is correct
7 Correct 26 ms 13188 KB Output is correct
8 Correct 28 ms 13688 KB Output is correct
9 Correct 32 ms 13640 KB Output is correct
10 Correct 45 ms 13384 KB Output is correct
11 Correct 32 ms 13480 KB Output is correct
12 Correct 30 ms 13616 KB Output is correct
13 Correct 37 ms 13384 KB Output is correct
14 Correct 36 ms 13676 KB Output is correct
15 Correct 32 ms 13708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 13036 KB Output is correct
2 Correct 0 ms 1032 KB Output is correct
3 Correct 26 ms 12584 KB Output is correct
4 Correct 40 ms 14428 KB Output is correct
5 Correct 44 ms 14364 KB Output is correct
6 Correct 27 ms 13040 KB Output is correct
7 Correct 26 ms 13188 KB Output is correct
8 Correct 28 ms 13688 KB Output is correct
9 Correct 32 ms 13640 KB Output is correct
10 Correct 45 ms 13384 KB Output is correct
11 Correct 32 ms 13480 KB Output is correct
12 Correct 30 ms 13616 KB Output is correct
13 Correct 37 ms 13384 KB Output is correct
14 Correct 36 ms 13676 KB Output is correct
15 Correct 32 ms 13708 KB Output is correct
16 Correct 23 ms 11504 KB Output is correct
17 Correct 25 ms 11908 KB Output is correct
18 Correct 24 ms 11908 KB Output is correct
19 Correct 24 ms 11876 KB Output is correct
20 Correct 28 ms 12528 KB Output is correct
21 Correct 26 ms 12240 KB Output is correct
22 Correct 30 ms 14348 KB Output is correct
23 Correct 25 ms 12024 KB Output is correct
24 Correct 25 ms 11988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1040 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 2324 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 2316 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -