Submission #547908

# Submission time Handle Problem Language Result Execution time Memory
547908 2022-04-12T02:42:14 Z quoccuong2k4ht Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
88 ms 9356 KB
#include "Anna.h"
#include <vector>
using namespace std;
namespace {

int variable_example = 0;

}

void Anna(int N, std::vector<char> S) {
    for (int i=0;i<N;i++) {
        if (S[i]=='X') {
            Send(0);
            Send(0);
        }
        if (S[i]=='Y') {
            Send(0);
            Send(1);
        }
        if (S[i]=='Z') {
            Send(1);
            Send(0);
        }
    }
}
#include "Bruno.h"
#include <vector>
using namespace std;

namespace {

int variable_example = 0;

int FunctionExample(int P) { return 1 - P; }

}  // namespace
void Bruno(int N, int L, std::vector<int> A) {
    vector<int> S;
    for (int i=0,tmp;i<L;i+=2) {
        tmp=A[i]*2+A[i+1];
        S.push_back(tmp);
    }
    if (N>20) {
        for (int i=0;i<N;i++) Remove(i);
        return;
    }
    #define x first
    #define y second
    vector<pair<int,int>> dd(1<<N,{0,0});
    vector<int> tmp;
    for (int tt=(1<<N)-1;tt;tt--) {
        tmp.clear();
        for (int i=0;i<N;i++) if (tt>>i&1) tmp.push_back(i);
        for (int i=0;i<tmp.size();i++) {
            if (S[tmp[i]]==1&&i>0&&S[tmp[i-1]]==0&&i+1<tmp.size()-1&&S[tmp[i+1]]==2)
                dd[tt^(1<<tmp[i])]=max(dd[tt^(1<<tmp[i])],{dd[tt].x+1,tmp[i]});
            else dd[tt^(1<<tmp[i])]=max(dd[tt^(1<<tmp[i])],{dd[tt].x,tmp[i]});
        }
    }
    int cur=0;
    vector<int> kq;
    while (cur+1!=(1<<N)) {
        kq.push_back(dd[cur].y);
        cur=cur^(1<<dd[cur].y);
    }
    for (int i=kq.size()-1;i>=0;i--) Remove(kq[i]);
}

Compilation message

Anna.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    6 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for (int i=0;i<tmp.size();i++) {
      |                      ~^~~~~~~~~~~
Bruno.cpp:30:55: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if (S[tmp[i]]==1&&i>0&&S[tmp[i-1]]==0&&i+1<tmp.size()-1&&S[tmp[i+1]]==2)
      |                                                    ~~~^~~~~~~~~~~~~
Bruno.cpp: At global scope:
Bruno.cpp:9:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
    9 | int FunctionExample(int P) { return 1 - P; }
      |     ^~~~~~~~~~~~~~~
Bruno.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 32 ms 2556 KB Output is correct
2 Correct 35 ms 2564 KB Output is correct
3 Correct 34 ms 2564 KB Output is correct
4 Correct 29 ms 2564 KB Output is correct
5 Incorrect 37 ms 2556 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 9356 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -