답안 #411095

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411095 2021-05-24T10:58:16 Z 장태환(#7543) 길고양이 (JOI20_stray) C++17
4 / 100
67 ms 21344 KB
#include "Anthony.h"
#include <vector>
#include <string.h>
#include <queue>
using namespace std;
namespace {

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

}  // namespace
vector<int>x;
int dist[200100];
vector<pair<int,int>>link[200100];
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 i;
  for (i = 0; i < M; i++)
  {
	  X[i] = -1;
	  link[U[i]].push_back({ V[i],i });
	  link[V[i]].push_back({ U[i],i });
  }
  queue<int>x;
  x.push(0);
  memset(dist, 1, sizeof(dist));
  dist[0] = 0;
  while (x.size())
  {
	  auto a = x.front();
	  x.pop();
	  for (i = 0; i < link[a].size(); i++)
	  {
		  if (dist[link[a][i].first] > dist[a] + 1)
		  {
			  dist[link[a][i].first] = dist[a] + 1;
			  X[link[a][i].second]=dist[a]%3;
			  x.push(link[a][i].first);
		  }
		 
	  }

  }
  for (i = 0; i < M; i++)
  {
	  if (X[i] == -1)
		  X[i] = dist[U[i]] % 3;
  }
  return X;
}
#include "Catherine.h"
#include <vector>

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 c = 0;
  int d = 0;
  for (int j = 0; j < A; ++j) 
  {
    if (y[j]) {
		c++;
		d += j;
    }
  }
  if (c == 1)
  {
	  return d;
  }
  else
  {
	  for(int j = 0; j < A; ++j)
	  {
		  if (y[j]==0) {
			  return (j + 1) % 3;
		  }
	  }
  }
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    for (i = 0; i < link[a].size(); i++)
      |                ~~^~~~~~~~~~~~~~~~
Anthony.cpp: At global scope:
Anthony.cpp:8:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
    8 | int FunctionExample(int i, int A) {
      |     ^~~~~~~~~~~~~~~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 20368 KB Output is correct
2 Correct 4 ms 6000 KB Output is correct
3 Correct 41 ms 19752 KB Output is correct
4 Correct 58 ms 21312 KB Output is correct
5 Correct 60 ms 21344 KB Output is correct
6 Correct 51 ms 20084 KB Output is correct
7 Correct 49 ms 20060 KB Output is correct
8 Correct 61 ms 20780 KB Output is correct
9 Correct 55 ms 20828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 20368 KB Output is correct
2 Correct 4 ms 6000 KB Output is correct
3 Correct 41 ms 19752 KB Output is correct
4 Correct 58 ms 21312 KB Output is correct
5 Correct 60 ms 21344 KB Output is correct
6 Correct 51 ms 20084 KB Output is correct
7 Correct 49 ms 20060 KB Output is correct
8 Correct 61 ms 20780 KB Output is correct
9 Correct 55 ms 20828 KB Output is correct
10 Incorrect 51 ms 18172 KB Wrong Answer [6]
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 17808 KB Output is correct
2 Correct 5 ms 5996 KB Output is correct
3 Correct 38 ms 17448 KB Output is correct
4 Correct 67 ms 19312 KB Output is correct
5 Correct 60 ms 19148 KB Output is correct
6 Correct 48 ms 17936 KB Output is correct
7 Correct 45 ms 17868 KB Output is correct
8 Correct 54 ms 18428 KB Output is correct
9 Correct 54 ms 18404 KB Output is correct
10 Correct 58 ms 18336 KB Output is correct
11 Correct 54 ms 18160 KB Output is correct
12 Correct 62 ms 18236 KB Output is correct
13 Correct 54 ms 18372 KB Output is correct
14 Correct 57 ms 18508 KB Output is correct
15 Correct 53 ms 18424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 17808 KB Output is correct
2 Correct 5 ms 5996 KB Output is correct
3 Correct 38 ms 17448 KB Output is correct
4 Correct 67 ms 19312 KB Output is correct
5 Correct 60 ms 19148 KB Output is correct
6 Correct 48 ms 17936 KB Output is correct
7 Correct 45 ms 17868 KB Output is correct
8 Correct 54 ms 18428 KB Output is correct
9 Correct 54 ms 18404 KB Output is correct
10 Correct 58 ms 18336 KB Output is correct
11 Correct 54 ms 18160 KB Output is correct
12 Correct 62 ms 18236 KB Output is correct
13 Correct 54 ms 18372 KB Output is correct
14 Correct 57 ms 18508 KB Output is correct
15 Correct 53 ms 18424 KB Output is correct
16 Correct 39 ms 16404 KB Output is correct
17 Correct 48 ms 16324 KB Output is correct
18 Incorrect 42 ms 16252 KB Wrong Answer [6]
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 6000 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 7224 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 7148 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -