Submission #770367

#TimeUsernameProblemLanguageResultExecution timeMemory
770367PlurmFlights (JOI22_flights)C++17
Compilation error
0 ms0 KiB
#include "Benjamin.h"
#include <string>
#include <vector>
using namespace std;

namespace {

const int MODX = 1024;
const int MODY = 1024;
int N, X, Y;

} // namespace

std::string SendB(int N, int X, int Y) {
    ::N = N;
    ::X = X;
    ::Y = Y;
    int mx = X % MODX;
    int my = Y % MODY;
    std::string msg;
    for (int i = 0; i < 10; i++) {
        if (mx & (1 << i))
            msg.push_back('1');
        else
            msg.push_back('0');
    }
    for (int i = 0; i < 10; i++) {
        if (my & (1 << i))
            msg.push_back('1');
        else
            msg.push_back('0');
    }
    return msg;
}

int Answer(std::string T) {
    int mx = X % MODX;
    int my = Y % MODY;
    int c = 0;
    for (int i = 0; i < N; i++)
        if (i % MODY == my)
            c++;
    int idx = X / MODX * c + Y / MODY;
    int d = 0;
    for (int i = 0; i < 14; i++) {
        if (T[idx + i] == '1')
            d |= 1 << i;
    }
    return d;
}
#include "Benjamin.h"
#include <string>
#include <vector>
using namespace std;

namespace {

const int MODX = 1024;
const int MODY = 1024;
int N, X, Y;

} // namespace

std::string SendB(int N, int X, int Y) {
    ::N = N;
    ::X = X;
    ::Y = Y;
    int mx = X % MODX;
    int my = Y % MODY;
    std::string msg;
    for (int i = 0; i < 10; i++) {
        if (mx & (1 << i))
            msg.push_back('1');
        else
            msg.push_back('0');
    }
    for (int i = 0; i < 10; i++) {
        if (my & (1 << i))
            msg.push_back('1');
        else
            msg.push_back('0');
    }
    return msg;
}

int Answer(std::string T) {
    int mx = X % MODX;
    int my = Y % MODY;
    int idx = X / MODX * ((N - my + MODY - 1) / MODY) + Y / MODY;
    int d = 0;
    for (int i = 0; i < 14; i++) {
        if (T[idx + i] == '1')
            d |= 1 << i;
    }
    return d;
}

Compilation message (stderr)

Ali.cpp: In function 'int Answer(std::string)':
Ali.cpp:37:9: warning: unused variable 'mx' [-Wunused-variable]
   37 |     int mx = X % MODX;
      |         ^~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~
/usr/bin/ld: /tmp/ccADHE9q.o: in function `main':
grader_ali.cpp:(.text.startup+0x3bb): undefined reference to `Init(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader_ali.cpp:(.text.startup+0x569): undefined reference to `SendA(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status

Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:37:9: warning: unused variable 'mx' [-Wunused-variable]
   37 |     int mx = X % MODX;
      |         ^~