Submission #978722

# Submission time Handle Problem Language Result Execution time Memory
978722 2024-05-09T14:36:15 Z vjudge1 Stray Cat (JOI20_stray) C++17
Compilation error
0 ms 0 KB
#include "Anthony.h"
#include "Catherine.h"
#include <bits/stdc++.h>

using namespace std;

int n,m,AA,BB;
vector<int> g[20005];
vector<pair<int,int>> e;
vector<int> d;

void bfs()
{
    d.resize(n);
    for (int i = 0; i < n; i++)
        d[i] = 1e9;
    d[0] = 0;
    queue<int> q;
    q.push(0);
    while (!q.empty())
    {
        int nod = q.front();
        q.pop();
        for (auto vecin : g[nod])
        {
            if (d[vecin] == 1e9)
            {
                d[vecin] = 1 + d[nod];
                q.push(vecin);
            }
        }
    }
}

vector<int> solve1()
{
    bfs();
    vector<int> ans(m);
    for (int i = 0; i < e.size(); i++)
    {
        int x = e[i].first,y = e[i].second;
        ans[i] = min(d[x],d[y]) % 3;
    }
    return ans;
}

vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V)
{
    n = N,m = M;
    AA = A,BB = B;
    for (int i = 0; i < m; i++)
    {
        g[U[i]].push_back(V[i]);
        g[V[i]].push_back(U[i]);
        e.push_back({U[i],V[i]});
    }
    if (A >= 3)
    {
        return solve1();
    }
}

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

int Move(vector<int> y)
{
    if (y[0] == 0 and y[1] == 0)
        return 2;
    if (y[1] == 0 and y[2] == 0)
        return 0;
    if (y[0] == 0 and y[2] == 0)
        return 1;
    if (y[2] == 0)
        return 0;
    if (y[0] == 0)
        return 1;
    return 2;
}




    

Compilation message

Anthony.cpp: In function 'std::vector<int> solve1()':
Anthony.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i = 0; i < e.size(); i++)
      |                     ~~^~~~~~~~~~
Anthony.cpp: In function 'void Init(int, int)':
Anthony.cpp:65:9: warning: unused variable 'xxx' [-Wunused-variable]
   65 |     int xxx = 123;
      |         ^~~
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
   61 | }
      | ^

/usr/bin/ld: /tmp/ccQXPveQ.o: in function `main':
grader_catherine.cpp:(.text.startup+0x41c): undefined reference to `Init(int, int)'
/usr/bin/ld: grader_catherine.cpp:(.text.startup+0xcfa): undefined reference to `Move(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status