답안 #786825

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
786825 2023-07-18T13:16:21 Z Boas 길고양이 (JOI20_stray) C++17
15 / 100
1615 ms 16540 KB
#include "Anthony.h"
#include <bits/stdc++.h>

namespace
{

}

using namespace std;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;

int a, m;

vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V)
{
  a = A;
  m = M;
  vector<int> X(M, -1);
  queue<pair<int, int>> q;
  q.push({0, A - 1});
  while (!q.empty())
  {
    auto &[i, mark] = q.front();
    q.pop();
    for (int j = 0; j < m; j++)
    {
      if (X[j] != -1)
        continue;
      if (U[j] == i)
      {
        cerr << "Road from " << U[j] << " to " << V[j] << " gets mark " << mark << endl;
        X[j] = mark;
        q.push({V[j], (mark - 1 + a) % a});
      }
      else if (V[j] == i)
      {
        cerr << "Road from " << U[j] << " to " << V[j] << " gets mark " << mark << endl;
        X[j] = mark;
        q.push({U[j], (mark - 1 + a) % a});
      }
    }
  }
  return X;
}
#include "Catherine.h"
#include <vector>
#include <map>
#include <iostream>

namespace
{

  int A, B;

} // namespace

void Init(int A, int B)
{
  ::A = A;
  ::B = B;
}
using namespace std;
int Move(std::vector<int> y)
{
  vector<int> leastOccurences = {};
  int least = (1 << 30);
  map<int, int> occurences;
  for (int j = 0; j < A; ++j)
  {
    if (y[j] > 0)
    {
      if (y[j] < least)
      {
        least = y[j];
        leastOccurences = {j};
      }
      else if (y[j] == least)
      {
        leastOccurences.push_back(j);
      }
      occurences[j] = y[j];
    }
  }
  if (A > 2)
  {
    if (occurences.find(A - 1) != occurences.end() && occurences.find(0) != occurences.end())
    {
      return 0;
    }
    int max = 0;
    for (const auto &[j, c] : occurences)
    {
      max = std::max(j, max);
    }
    return max;
  }

  if (leastOccurences.size() == 0)
  {
    throw;
    return -1;
  }

  if (leastOccurences.size() == 1)
    return leastOccurences[0];
  // extra code for long straight lines with A = 2
  return -2;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1301 ms 15296 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 413 ms 14524 KB Output is correct
4 Correct 1318 ms 16532 KB Output is correct
5 Correct 1335 ms 16540 KB Output is correct
6 Correct 1333 ms 15056 KB Output is correct
7 Correct 1315 ms 15076 KB Output is correct
8 Correct 1333 ms 15796 KB Output is correct
9 Correct 1345 ms 15704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1301 ms 15296 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 413 ms 14524 KB Output is correct
4 Correct 1318 ms 16532 KB Output is correct
5 Correct 1335 ms 16540 KB Output is correct
6 Correct 1333 ms 15056 KB Output is correct
7 Correct 1315 ms 15076 KB Output is correct
8 Correct 1333 ms 15796 KB Output is correct
9 Correct 1345 ms 15704 KB Output is correct
10 Correct 1311 ms 13176 KB Output is correct
11 Correct 1255 ms 13224 KB Output is correct
12 Correct 1335 ms 13240 KB Output is correct
13 Correct 1323 ms 13144 KB Output is correct
14 Correct 1342 ms 13496 KB Output is correct
15 Correct 1329 ms 13852 KB Output is correct
16 Correct 1325 ms 15984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1315 ms 12860 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 1162 ms 12276 KB Output is correct
4 Correct 1404 ms 14284 KB Output is correct
5 Correct 1291 ms 14168 KB Output is correct
6 Correct 1347 ms 12884 KB Output is correct
7 Correct 1323 ms 12924 KB Output is correct
8 Correct 1329 ms 13528 KB Output is correct
9 Correct 1330 ms 13596 KB Output is correct
10 Correct 1311 ms 13488 KB Output is correct
11 Correct 1316 ms 13252 KB Output is correct
12 Correct 1349 ms 13152 KB Output is correct
13 Correct 1284 ms 13252 KB Output is correct
14 Correct 1295 ms 13608 KB Output is correct
15 Correct 1351 ms 13608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1315 ms 12860 KB Output is correct
2 Correct 1 ms 520 KB Output is correct
3 Correct 1162 ms 12276 KB Output is correct
4 Correct 1404 ms 14284 KB Output is correct
5 Correct 1291 ms 14168 KB Output is correct
6 Correct 1347 ms 12884 KB Output is correct
7 Correct 1323 ms 12924 KB Output is correct
8 Correct 1329 ms 13528 KB Output is correct
9 Correct 1330 ms 13596 KB Output is correct
10 Correct 1311 ms 13488 KB Output is correct
11 Correct 1316 ms 13252 KB Output is correct
12 Correct 1349 ms 13152 KB Output is correct
13 Correct 1284 ms 13252 KB Output is correct
14 Correct 1295 ms 13608 KB Output is correct
15 Correct 1351 ms 13608 KB Output is correct
16 Correct 1615 ms 11284 KB Output is correct
17 Correct 1513 ms 11520 KB Output is correct
18 Correct 1298 ms 11272 KB Output is correct
19 Correct 1279 ms 11312 KB Output is correct
20 Correct 1347 ms 12084 KB Output is correct
21 Correct 1283 ms 11700 KB Output is correct
22 Correct 1287 ms 13700 KB Output is correct
23 Correct 1287 ms 11652 KB Output is correct
24 Correct 1325 ms 11512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 900 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1311 ms 11128 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1309 ms 11024 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -