Submission #100001

# Submission time Handle Problem Language Result Execution time Memory
100001 2019-03-09T06:21:27 Z cheeheng Broken Device (JOI17_broken_device) C++14
0 / 100
63 ms 3512 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 >= -123){
        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 Incorrect 43 ms 3056 KB Output isn't correct - L* = 0
2 Incorrect 47 ms 3056 KB Output isn't correct - L* = 0
3 Incorrect 41 ms 3312 KB Output isn't correct - L* = 0
4 Incorrect 52 ms 3312 KB Output isn't correct - L* = 0
5 Incorrect 46 ms 3056 KB Output isn't correct - L* = 0
6 Incorrect 42 ms 3328 KB Output isn't correct - L* = 0
7 Incorrect 53 ms 3056 KB Output isn't correct - L* = 0
8 Incorrect 44 ms 3216 KB Output isn't correct - L* = 0
9 Incorrect 37 ms 3328 KB Output isn't correct - L* = 0
10 Incorrect 49 ms 3064 KB Output isn't correct - L* = 0
11 Incorrect 47 ms 3312 KB Output isn't correct - L* = 0
12 Incorrect 46 ms 3312 KB Output isn't correct - L* = 0
13 Incorrect 39 ms 3328 KB Output isn't correct - L* = 0
14 Incorrect 51 ms 3072 KB Output isn't correct - L* = 0
15 Incorrect 39 ms 3072 KB Output isn't correct - L* = 0
16 Incorrect 45 ms 3328 KB Output isn't correct - L* = 0
17 Incorrect 53 ms 3312 KB Output isn't correct - L* = 0
18 Incorrect 38 ms 3072 KB Output isn't correct - L* = 0
19 Incorrect 62 ms 3328 KB Output isn't correct - L* = 0
20 Incorrect 36 ms 3328 KB Output isn't correct - L* = 0
21 Incorrect 36 ms 3328 KB Output isn't correct - L* = 0
22 Incorrect 45 ms 3328 KB Output isn't correct - L* = 0
23 Incorrect 53 ms 3320 KB Output isn't correct - L* = 0
24 Incorrect 51 ms 3312 KB Output isn't correct - L* = 0
25 Incorrect 43 ms 3072 KB Output isn't correct - L* = 0
26 Incorrect 42 ms 3072 KB Output isn't correct - L* = 0
27 Incorrect 43 ms 3072 KB Output isn't correct - L* = 0
28 Incorrect 49 ms 3056 KB Output isn't correct - L* = 0
29 Incorrect 37 ms 3072 KB Output isn't correct - L* = 0
30 Incorrect 38 ms 3328 KB Output isn't correct - L* = 0
31 Incorrect 42 ms 3328 KB Output isn't correct - L* = 0
32 Incorrect 53 ms 3328 KB Output isn't correct - L* = 0
33 Incorrect 46 ms 3056 KB Output isn't correct - L* = 0
34 Incorrect 50 ms 3312 KB Output isn't correct - L* = 0
35 Incorrect 43 ms 3312 KB Output isn't correct - L* = 0
36 Incorrect 63 ms 3056 KB Output isn't correct - L* = 0
37 Incorrect 48 ms 3072 KB Output isn't correct - L* = 0
38 Incorrect 45 ms 3512 KB Output isn't correct - L* = 0
39 Incorrect 40 ms 3328 KB Output isn't correct - L* = 0
40 Incorrect 34 ms 3072 KB Output isn't correct - L* = 0