| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 926933 | manizare | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 0 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define F first
#define S second 
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long 
#define pii pair <int,int>
#define PII pair<pii , pii>
#define sz(v) (int)v.size()
#define rep(i , a , b) for(int i=a;i <= (b);i++)
#define per(i , a , b) for(int i=a;i >= (b);i--)
#define deb(x) cout <<#x << " : " << x << "\n" ;
using namespace std ;
const int maxn = 1e6 + 10  , c = 6 , maxp = 15e5 + 10 , inf=  1e18+10 ;
int ans[maxn] , dp[maxn] ,a3[100] , A[maxn] , B[maxn] , id[maxn] ; 
bitset<258> mark[3000] ;
signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    a3[0] = 1;
    rep(i , 1 , 30){
        a3[i] = a3[i-1] * 3 ;
    }
    int n, Q; cin >> n >> Q  ;
    string s;
    cin >> s; 
    rep(i , 1, (1<<n)-1){
        int x= 1  ;
        rep(j , 0 , n-1){
            sm[i] = sm[i] + (i>>j&1)*a3[j] ;
        }
    }
    rep(i , 0 , a3[c+1]-1){
        rep(j , 0 , (1<<(c+1))-1){
            mark[i][j] =1 ;
            rep(k, 0 , c){
                if((i/a3[k])%3!=0 && ((i/a3[k])%3)-1 != (j>>k&1)){
                    mark[i][j] = 0;
                }
            }
        }
    }
    return 0;
}
/*
 
*/
