답안 #829882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829882 2023-08-18T15:34:43 Z Rifal 길고양이 (JOI20_stray) C++14
4 / 100
43 ms 16864 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);
                }
            }
        }
    }
}

std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::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[i] = 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(std::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 27 ms 15700 KB Output is correct
2 Correct 1 ms 1036 KB Output is correct
3 Correct 27 ms 15076 KB Output is correct
4 Correct 34 ms 16864 KB Output is correct
5 Correct 38 ms 16836 KB Output is correct
6 Correct 28 ms 15464 KB Output is correct
7 Correct 26 ms 15552 KB Output is correct
8 Correct 34 ms 16268 KB Output is correct
9 Correct 43 ms 16160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 15700 KB Output is correct
2 Correct 1 ms 1036 KB Output is correct
3 Correct 27 ms 15076 KB Output is correct
4 Correct 34 ms 16864 KB Output is correct
5 Correct 38 ms 16836 KB Output is correct
6 Correct 28 ms 15464 KB Output is correct
7 Correct 26 ms 15552 KB Output is correct
8 Correct 34 ms 16268 KB Output is correct
9 Correct 43 ms 16160 KB Output is correct
10 Runtime error 7 ms 3460 KB Execution killed with signal 6
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13340 KB Output is correct
2 Correct 1 ms 1080 KB Output is correct
3 Correct 23 ms 12892 KB Output is correct
4 Correct 32 ms 14620 KB Output is correct
5 Correct 33 ms 14708 KB Output is correct
6 Correct 28 ms 13316 KB Output is correct
7 Correct 34 ms 13360 KB Output is correct
8 Correct 32 ms 13792 KB Output is correct
9 Correct 30 ms 13920 KB Output is correct
10 Correct 33 ms 13640 KB Output is correct
11 Correct 38 ms 13656 KB Output is correct
12 Correct 31 ms 13636 KB Output is correct
13 Correct 34 ms 13652 KB Output is correct
14 Correct 32 ms 13852 KB Output is correct
15 Correct 33 ms 13912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 13340 KB Output is correct
2 Correct 1 ms 1080 KB Output is correct
3 Correct 23 ms 12892 KB Output is correct
4 Correct 32 ms 14620 KB Output is correct
5 Correct 33 ms 14708 KB Output is correct
6 Correct 28 ms 13316 KB Output is correct
7 Correct 34 ms 13360 KB Output is correct
8 Correct 32 ms 13792 KB Output is correct
9 Correct 30 ms 13920 KB Output is correct
10 Correct 33 ms 13640 KB Output is correct
11 Correct 38 ms 13656 KB Output is correct
12 Correct 31 ms 13636 KB Output is correct
13 Correct 34 ms 13652 KB Output is correct
14 Correct 32 ms 13852 KB Output is correct
15 Correct 33 ms 13912 KB Output is correct
16 Runtime error 7 ms 3572 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1088 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 2552 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 2568 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -