#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);
}
}
}
}
/*
//#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;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
788 KB |
Wrong Answer [4] |
2 |
Incorrect |
4 ms |
652 KB |
Wrong Answer [4] |
3 |
Incorrect |
4 ms |
788 KB |
Wrong Answer [4] |
4 |
Incorrect |
9 ms |
904 KB |
Wrong Answer [4] |
5 |
Incorrect |
5 ms |
780 KB |
Wrong Answer [4] |
6 |
Incorrect |
5 ms |
780 KB |
Wrong Answer [4] |
7 |
Incorrect |
5 ms |
908 KB |
Wrong Answer [4] |
8 |
Incorrect |
5 ms |
780 KB |
Wrong Answer [4] |
9 |
Incorrect |
4 ms |
908 KB |
Wrong Answer [4] |
10 |
Incorrect |
4 ms |
780 KB |
Wrong Answer [4] |
11 |
Incorrect |
5 ms |
904 KB |
Wrong Answer [4] |
12 |
Incorrect |
4 ms |
876 KB |
Wrong Answer [4] |
13 |
Incorrect |
5 ms |
560 KB |
Wrong Answer [4] |
14 |
Incorrect |
4 ms |
876 KB |
Wrong Answer [4] |
15 |
Incorrect |
4 ms |
916 KB |
Wrong Answer [4] |
16 |
Incorrect |
4 ms |
780 KB |
Wrong Answer [4] |
17 |
Incorrect |
5 ms |
780 KB |
Wrong Answer [4] |
18 |
Incorrect |
3 ms |
904 KB |
Wrong Answer [4] |
19 |
Incorrect |
4 ms |
652 KB |
Wrong Answer [4] |
20 |
Incorrect |
6 ms |
788 KB |
Wrong Answer [4] |
21 |
Incorrect |
5 ms |
940 KB |
Wrong Answer [4] |
22 |
Incorrect |
4 ms |
780 KB |
Wrong Answer [4] |
23 |
Incorrect |
4 ms |
652 KB |
Wrong Answer [4] |
24 |
Incorrect |
4 ms |
780 KB |
Wrong Answer [4] |
25 |
Incorrect |
5 ms |
880 KB |
Wrong Answer [4] |
26 |
Incorrect |
5 ms |
916 KB |
Wrong Answer [4] |
27 |
Incorrect |
6 ms |
916 KB |
Wrong Answer [4] |
28 |
Incorrect |
5 ms |
880 KB |
Wrong Answer [4] |
29 |
Incorrect |
4 ms |
908 KB |
Wrong Answer [4] |
30 |
Incorrect |
5 ms |
788 KB |
Wrong Answer [4] |
31 |
Incorrect |
4 ms |
908 KB |
Wrong Answer [4] |
32 |
Incorrect |
4 ms |
788 KB |
Wrong Answer [4] |
33 |
Incorrect |
6 ms |
652 KB |
Wrong Answer [4] |
34 |
Incorrect |
3 ms |
780 KB |
Wrong Answer [4] |
35 |
Incorrect |
5 ms |
652 KB |
Wrong Answer [4] |
36 |
Incorrect |
4 ms |
780 KB |
Wrong Answer [4] |
37 |
Incorrect |
4 ms |
780 KB |
Wrong Answer [4] |
38 |
Incorrect |
5 ms |
652 KB |
Wrong Answer [4] |
39 |
Incorrect |
5 ms |
780 KB |
Wrong Answer [4] |
40 |
Incorrect |
4 ms |
640 KB |
Wrong Answer [4] |