Submission #100056

#TimeUsernameProblemLanguageResultExecution timeMemory
100056SomeoneUnknownBroken Device (JOI17_broken_device)C++14
0 / 100
75 ms3264 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    long long xpr = X;
    int pptr = 0;
    for( int i = 0; i < N; i+=3 ){
        //Set( i, 0 );
        int corrcount = 0;
        bool corecorr = false;
        int lm3 = xpr%3;
        while(P[pptr] < i+3){
            if(P[pptr] == i+lm3) corecorr = true;
            corrcount++;
            pptr++;
        }
        if(corrcount>1){
            for(int j = 0; j < 3; j++)
                Set(i+j, 0);
            continue;
        }
        if(corecorr){
            for(int j = 0; j < 3; j++)
                Set(i+j, j!=lm3);
        }else{
            for(int j = 0; j < 3; j++)
                Set(i+j, j==lm3);
        }
    }
}
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
    long long res = 0;
    bool clean = 0;
    int p0 = 0;
    int p1 = 0;
    for(int i = N-3; i >= 0; i-=3){
        for(int j = 0; j < 3; j++){
            if(A[i+j] == 1){
                clean++;
                p1 = j;
            }else{
                p0=j;
            }
        }
        if(clean == 0) continue;
        if(clean == 1){
            res *= 3;
            res += p1;
        }else{
            res *= 3;
            res += p0;
        }
    }
}

Compilation message (stderr)

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:11:22: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
                 clean++;
                      ^~
Bruno.cpp:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...