답안 #924190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
924190 2024-02-08T16:02:21 Z Camillus Floppy (RMI20_floppy) C++17
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
#define debug(...) 42
using namespace std;

#ifndef LOCAL
#include "floppy.h"
#else
void init(int n, const char s[]);
int query(int i, int k);
#endif

string s;

void init(int N, const char S[]) {
    s = string(S, S + N);
}

int query(int i, int k) {
    for (int j = 0; j < (1 << k); j++) {
        auto t = bitset<32>(j).to_string();
        reverse(t.begin(), t.end());
        swap(t[0], t[k - 1]);
        reverse(t.begin(), t.end());
        int k = bitset<32>(t).to_ulong();

        debug(j, k);
        debug(s);
        debug(i + j);
        debug(i + k);
        debug(s[i + j], s[i + k]);

        if (s[i + j] != s[i + k]) {
            return false;
        }
    }
    return true;
}

#ifdef LOCAL
char __s[(int)5e5 + 10] = {};

int main() {
    cin >> __s;
    init(strlen(__s), __s);

    int __x, __y;
    while (cin >> __x >> __y)
        cout << query(__x, __y) << '\n';

    return 0;
}
#endif

Compilation message

floppy.cpp: In function 'int query(int, int)':
floppy.cpp:2:20: warning: statement has no effect [-Wunused-value]
    2 | #define debug(...) 42
      |                    ^~
floppy.cpp:26:9: note: in expansion of macro 'debug'
   26 |         debug(j, k);
      |         ^~~~~
floppy.cpp:2:20: warning: statement has no effect [-Wunused-value]
    2 | #define debug(...) 42
      |                    ^~
floppy.cpp:27:9: note: in expansion of macro 'debug'
   27 |         debug(s);
      |         ^~~~~
floppy.cpp:2:20: warning: statement has no effect [-Wunused-value]
    2 | #define debug(...) 42
      |                    ^~
floppy.cpp:28:9: note: in expansion of macro 'debug'
   28 |         debug(i + j);
      |         ^~~~~
floppy.cpp:2:20: warning: statement has no effect [-Wunused-value]
    2 | #define debug(...) 42
      |                    ^~
floppy.cpp:29:9: note: in expansion of macro 'debug'
   29 |         debug(i + k);
      |         ^~~~~
floppy.cpp:2:20: warning: statement has no effect [-Wunused-value]
    2 | #define debug(...) 42
      |                    ^~
floppy.cpp:30:9: note: in expansion of macro 'debug'
   30 |         debug(s[i + j], s[i + k]);
      |         ^~~~~
stub.cpp: In function 'void run2()':
stub.cpp:101:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  101 |     if (query_answers.size() != M) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccruQOZC.o: in function `run2()':
stub.cpp:(.text+0x698): undefined reference to `solve_queries(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&)'
/usr/bin/ld: /tmp/ccruQOZC.o: in function `run1()':
stub.cpp:(.text+0xb1d): undefined reference to `read_array(int, std::vector<int, std::allocator<int> > const&)'
collect2: error: ld returned 1 exit status