Submission #89275

# Submission time Handle Problem Language Result Execution time Memory
89275 2018-12-11T08:26:37 Z Badral Beautiful row (IZhO12_beauty) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
ll a[55], n, b[55][55];
 
ll 3t(ll x) {ll s = 0; while (x) {s += (x % 3 == 1); x /= 3; } return s; }
ll 2t(ll x) {ll s = 0; while (x) {s += (x % 2 == 1); x /= 2; } return s; }
ll c[1 << 20][20], ans;

int main() {
	ll n;
	cin >>n;
	for(ll i = 0; i < n; i++) {
		ll x;
		cin >>x;
		a[i] = x;
		c[1 << i][i]++;
	}
	for(ll i = 0; i < n; i++) 
		for(ll j = 0; j < n; j++) 
			if(3t(a[i]) == 3t(a[j]) || 2t(a[i]) == 2t(a[j])) 
				b[i][j] = 1;

	for(ll i = 1; i < (1 << n); i++)
		for(ll j = 0; j < n; j++) {
      		if((i >> j) & 1 ^ 1) continue;
			for(ll k = 0; k < n; k++) 
				if(((i >> k) & 1 ^ 1) && b[j][k]) 
					c[i | (1 << k)][k] += c[i][j];
		}

	for(ll i = 0; i < n; i++) ans += c[(1 << n) - 1][i];
	cout<<ans;
}

Compilation message

beauty.cpp:8:4: error: expected unqualified-id before numeric constant
 ll 3t(ll x) {ll s = 0; while (x) {s += (x % 3 == 1); x /= 3; } return s; }
    ^~
beauty.cpp:9:4: error: expected unqualified-id before numeric constant
 ll 2t(ll x) {ll s = 0; while (x) {s += (x % 2 == 1); x /= 2; } return s; }
    ^~
beauty.cpp: In function 'int main()':
beauty.cpp:23:7: error: unable to find numeric literal operator 'operator""t'
    if(3t(a[i]) == 3t(a[j]) || 2t(a[i]) == 2t(a[j])) 
       ^~
beauty.cpp:23:7: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
beauty.cpp:23:19: error: unable to find numeric literal operator 'operator""t'
    if(3t(a[i]) == 3t(a[j]) || 2t(a[i]) == 2t(a[j])) 
                   ^~
beauty.cpp:23:19: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
beauty.cpp:23:31: error: unable to find numeric literal operator 'operator""t'
    if(3t(a[i]) == 3t(a[j]) || 2t(a[i]) == 2t(a[j])) 
                               ^~
beauty.cpp:23:31: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
beauty.cpp:23:43: error: unable to find numeric literal operator 'operator""t'
    if(3t(a[i]) == 3t(a[j]) || 2t(a[i]) == 2t(a[j])) 
                                           ^~
beauty.cpp:23:43: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
beauty.cpp:28:21: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
         if((i >> j) & 1 ^ 1) continue;
            ~~~~~~~~~^~~
beauty.cpp:30:18: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
     if(((i >> k) & 1 ^ 1) && b[j][k]) 
         ~~~~~~~~~^~~