Submission #530487

#TimeUsernameProblemLanguageResultExecution timeMemory
530487byunjaewooBroken Device (JOI17_broken_device)C++17
0 / 100
37 ms2432 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

bool chk[155];

void Anna( int N, long long X, int K, int P[] ){
    fill(chk, chk+151, 0);
    for(int i=0; i<K; i++) chk[P[i]]=true;
    vector<int> V;
    while(X) {
        V.push_back(X%2);
        X/=2;
    }
    if(V.size()%2) V.push_back(0);
    for(int i=0, p=0; i<150; i+=3) {
        if(chk[i] || chk[i+1] || chk[i+2] || p>=V.size()) {
            Set(i, 0); Set(i+1, 0); Set(i+2, 0); continue;
        }
        int a, b, c;
        if(V[p]) a=1, b=1;
        else a=1, b=0;
        if(V[p+1]) c=!b;
        else c=b;
        Set(i, a); Set(i+1, b); Set(i+2, c);
        p+=2;
    }
}
#include <bits/stdc++.h>
using namespace std;
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
    long long x=0;
    for(int i=N-1; i>=0; i-=3) {
        if(!A[i] && !A[i-1] && !A[i-2]) continue;
        x*=2; x+=(A[i]^A[i-1]);
        x*=2; x+=(A[i-1]^A[i-2]);
    }
    return x;
}

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:17:47: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         if(chk[i] || chk[i+1] || chk[i+2] || p>=V.size()) {
      |                                              ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...