Submission #99999

# Submission time Handle Problem Language Result Execution time Memory
99999 2019-03-09T06:17:54 Z cheeheng Broken Device (JOI17_broken_device) C++14
0 / 100
8 ms 512 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

//void Set( int pos, int bit );

void Anna( int N, long long X, int K, int P[] ){
    if(K == 1){
        if(P[0] >= 60){
            for(int i = 0; i < 60; i ++){
                Set(i, (X&(1<<i)) != 0);
            }
            for(int i = 60; i < 150; i ++){
                Set(i, 0);
            }
        }else{
            for(int i = 0; i < 60; i ++){
                Set(i + 90, (X&(1<<i)) != 0);
            }
            for(int i = 0; i < 90; i ++){
                Set(i, 0);
            }
        }
    }else{
        throw;
    }
}
/*
//#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

long long Bruno( int N, int A[] ){
    long long X1 = 0;
    long long X2 = 0;
    for(int i = 0; i < 60; i ++){
        X1 |= (A[i]<<i);
    }
    for(int i = 0; i < 60; i ++){
        X2 |= (A[i+90]<<i);
    }
    if(X1 == 0 && X2 == 0){
        return 0LL;
    }else if(X1 == 0){
        return X2;
    }else{
        return X1;
    }
}

#define MAX_K 40
#define MAX_N 150

static int Q, N, K, A[MAX_N], P[MAX_K];
static long long X;
static int min_wa = MAX_K + 1;

void Anna( int N, long long X, int K, int P[] );
long long Bruno( int N, int A[] );

void WrongAnswer( int e ){
  fprintf( stderr, "Wrong Answer [%d]\n", e );
  exit( 0 );
}

void Set( int pos, int bit ){
  if( !( 0 <= pos && pos < N ) ){
    WrongAnswer( 1 );
  }
  if( A[pos] != -1 ){
    WrongAnswer( 2 );
  }
  if( !( bit == 0 || bit == 1 ) ){
    WrongAnswer( 3 );
  }
  A[pos] = bit;
}

int main( int argc, char** argv ){
  int i, query_cnt;
  long long ans;

  scanf( "%d", &Q );

  for( query_cnt = 0; query_cnt < Q; query_cnt++ ){
    scanf( "%d %lld %d", &N, &X, &K );
    for( i = 0; i < K; i++ ){
      scanf( "%d", &P[i] );
    }

    for( i = 0; i < N; i++ ){
      A[i] = -1;
    }

    Anna( N, X, K, P );

    for( i = 0; i < N; i++ ){
      if( A[i] == -1 ){
        WrongAnswer( 4 );
      }
    }

    for( i = 0; i < K; i++ ){
      A[ P[i] ] = 0;
    }

    ans = Bruno( N, A );

    if( ans != X ){
      if( K < min_wa ){
        min_wa = K;
      }
    }
  }

  if( min_wa == 1 ){
    if( K < min_wa ){
      min_wa = K;
    }
  }

  fprintf( stderr, "Accepted\n" );
  fprintf( stderr, "L* = %d\n", min_wa - 1 );

  return 0;
}
*/
//#include "Annalib.h"
/*#include <bits/stdc++.h>
using namespace std;

void Set( int pos, int bit );

void Anna( int N, long long X, int K, int P[] ){
    if(K == 1){
        if(P[0] >= 60){
            for(int i = 0; i < 60; i ++){
                Set(i, (X&(1<<i)) != 0);
            }
            for(int i = 60; i < 150; i ++){
                Set(i, 0);
            }
        }else{
            for(int i = 0; i < 60; i ++){
                Set(i + 90, (X&(1<<i)) != 0);
            }
            for(int i = 0; i < 90; i ++){
                Set(i, 0);
            }
        }
    }else{
        throw;
    }
}
*/
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

long long Bruno( int N, int A[] ){
    long long X1 = 0;
    long long X2 = 0;
    for(int i = 0; i < 60; i ++){
        X1 |= (A[i]<<i);
    }
    for(int i = 0; i < 60; i ++){
        X2 |= (A[i+90]<<i);
    }
    if(X1 == 0 && X2 == 0){
        return 0LL;
    }else if(X1 == 0){
        return X2;
    }else{
        return X1;
    }
}
/*
#define MAX_K 40
#define MAX_N 150

static int Q, N, K, A[MAX_N], P[MAX_K];
static long long X;
static int min_wa = MAX_K + 1;

void Anna( int N, long long X, int K, int P[] );
long long Bruno( int N, int A[] );

void WrongAnswer( int e ){
  fprintf( stderr, "Wrong Answer [%d]\n", e );
  exit( 0 );
}

void Set( int pos, int bit ){
  if( !( 0 <= pos && pos < N ) ){
    WrongAnswer( 1 );
  }
  if( A[pos] != -1 ){
    WrongAnswer( 2 );
  }
  if( !( bit == 0 || bit == 1 ) ){
    WrongAnswer( 3 );
  }
  A[pos] = bit;
}

int main( int argc, char** argv ){
  int i, query_cnt;
  long long ans;

  scanf( "%d", &Q );

  for( query_cnt = 0; query_cnt < Q; query_cnt++ ){
    scanf( "%d %lld %d", &N, &X, &K );
    for( i = 0; i < K; i++ ){
      scanf( "%d", &P[i] );
    }

    for( i = 0; i < N; i++ ){
      A[i] = -1;
    }

    Anna( N, X, K, P );

    for( i = 0; i < N; i++ ){
      if( A[i] == -1 ){
        WrongAnswer( 4 );
      }
    }

    for( i = 0; i < K; i++ ){
      A[ P[i] ] = 0;
    }

    ans = Bruno( N, A );

    if( ans != X ){
      if( K < min_wa ){
        min_wa = K;
      }
    }
  }

  if( min_wa == 1 ){
    if( K < min_wa ){
      min_wa = K;
    }
  }

  fprintf( stderr, "Accepted\n" );
  fprintf( stderr, "L* = %d\n", min_wa - 1 );

  return 0;
}
*/
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 2 ms 404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 8 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)