답안 #166676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166676 2019-12-03T12:59:49 Z CaroLinda 질문 (CEOI14_question_grader) C++14
100 / 100
1650 ms 86056 KB
#include <bits/stdc++.h>

#define lp(i,a,b) for(int i=a;i<b;i++)
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define sz size()

using namespace std ;

int type , t , n , a , b ;
vector<int> v ;
bool ok = false ;

bool isOn(int m, int bit) { return ((1<<bit)&m) != 0 ; }

int encode(int n , int x , int y)
{

      if(!ok)
      {
        lp(i,1,(1<<12))
          if( __builtin_popcount(i) == 6 ) v.pb( i ) ;
        ok = true ;
      }

      lp(i,0,12)
        if( isOn(v[x-1],i) && !isOn(v[y-1], i) )
          return i+1 ;

}

#include <bits/stdc++.h>

#define lp(i,a,b) for(int i=a;i<b;i++)
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define sz size()

using namespace std ;

vector<int> v ;
bool ok = false ;

bool isOn(int m, int bit) { return ((1<<bit)&m) != 0 ; }

bool decode(int n, int q, int h)
{

  if(!ok)
  {
    lp(i,1,(1<<12))
      if( __builtin_popcount(i) == 6 ) v.pb(i) ;
    ok = true ;
  }

  if( isOn(v[q-1],h-1) ) return true ;
  return false ;

}


Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1618 ms 86056 KB Output is correct - maxh = 12
2 Correct 1650 ms 85768 KB Output is correct - maxh = 12