Submission #709622

# Submission time Handle Problem Language Result Execution time Memory
709622 2023-03-14T03:31:18 Z lmqzzz Ancient Machine (JOI21_ancient_machine) C++17
Compilation error
0 ms 0 KB
#include "Anna.h"

void send(int x) {
        bitset<17> a(x);
        for (int i = 0; i < 17; i++) Send(a[i]);
}

void Anna(int N, std::vector<char> S) {
        string temp = "XYZ";
        int j = 0;
        for (int i = 0; i < N; i++) {
                if (S[i] == temp[j]) {
                        j++;
                        j %= 3;
                        send(i);
                }
        }
}
#include "Bruno.h"

#include <bits/stdc++.h>
using namespace std;
int a[100001];

void Bruno(int N, int L, std::vector<int> A) {
        assert(L % 17 == 0);
        vector<int> v;
        for (int i = 0; i < L; i += 17) {
                int pos = 0;
                for (int j = i; j < i + 17; j++) {
                        if (A[j]) pos |= 1 << (j - i);
                }
                v.emplace_back(pos);
                a[pos] = 1;
        }
        for (int i = 0; i < N; i++)
                if (a[i] == 0) Remove(i);
        for (int i = 1; i < v.size(); i += 3) {
                Remove(v[i]);
        }
        for (int i = 0; i < v.size(); i++) {
                if (i % 3 == 1) continue;
                Remove(v[i]);
        }
}

Compilation message

Anna.cpp: In function 'void send(int)':
Anna.cpp:4:9: error: 'bitset' was not declared in this scope
    4 |         bitset<17> a(x);
      |         ^~~~~~
Anna.cpp:4:20: error: 'a' was not declared in this scope
    4 |         bitset<17> a(x);
      |                    ^
Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:9:9: error: 'string' was not declared in this scope
    9 |         string temp = "XYZ";
      |         ^~~~~~
Anna.cpp:12:29: error: 'temp' was not declared in this scope
   12 |                 if (S[i] == temp[j]) {
      |                             ^~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:20:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for (int i = 1; i < v.size(); i += 3) {
      |                         ~~^~~~~~~~~~
Bruno.cpp:23:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for (int i = 0; i < v.size(); i++) {
      |                         ~~^~~~~~~~~~