Submission #3418065


Source Code Expand

#include<cstdio>
#include<algorithm>
#include<map>
#include<cstring>
#include<cmath>
#include<iostream>
using namespace std;
typedef long long LL;

map<pair <string,string>,LL> cnt;
const int maxn = 50;
char s[maxn];

int main()
{
    int n; scanf("%d",&n);
    scanf("%s",s);
    for(int i = 0;i < (1 << n);i++)
	{ 
        string s1 = "",s2 = "";
        for(int j = 0;j < n;j++)
		{
            if(i & (1 << j)) s1 += s[j]; 
            else s2 += s[j];
        }
        cnt[make_pair(s1,s2)]++; 
    }
    LL sum = 0;
    for(int i = 0;i < (1 << n);i++)
	{ 
        string s1 = "",s2 = "";
        for(int j = n - 1;j >= 0;j--)
		{
            if(i & (1 << j)) s2 += s[j + n]; 
            else s1 += s[j + n]; 
        }
        sum += cnt[make_pair(s1,s2)]; 
    }
    printf("%lld\n",sum);
}

Submission Info

Submission Time
Task C - String Coloring
User Ez3real
Language C++14 (GCC 5.4.1)
Score 600
Code Size 838 Byte
Status AC
Exec Time 754 ms
Memory 91904 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int n; scanf("%d",&n);
                          ^
./Main.cpp:17:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",s);
                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 4
AC × 43
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All almost_z_0, almost_z_1, almost_z_2, almost_z_3, bigrand_0, bigrand_1, bigrand_2, example_0, example_1, example_2, example_3, handmade_0, handmade_1, nonzero_0, nonzero_1, nonzero_2, nonzero_3, nonzero_4, nonzero_5, nonzero_sc_0, nonzero_sc_1, nonzero_sc_10, nonzero_sc_11, nonzero_sc_2, nonzero_sc_3, nonzero_sc_4, nonzero_sc_5, nonzero_sc_6, nonzero_sc_7, nonzero_sc_8, nonzero_sc_9, nonzero_small_0, nonzero_small_1, nonzero_small_2, nonzero_small_3, rand_0, rand_1, rand_2, runnur_0, runnur_1, runnur_2, runnur_3, runnur_4
Case Name Status Exec Time Memory
almost_z_0 AC 370 ms 256 KB
almost_z_1 AC 383 ms 256 KB
almost_z_2 AC 346 ms 256 KB
almost_z_3 AC 365 ms 256 KB
bigrand_0 AC 669 ms 60416 KB
bigrand_1 AC 747 ms 91904 KB
bigrand_2 AC 694 ms 70144 KB
example_0 AC 1 ms 256 KB
example_1 AC 4 ms 384 KB
example_2 AC 1 ms 256 KB
example_3 AC 346 ms 256 KB
handmade_0 AC 1 ms 256 KB
handmade_1 AC 1 ms 256 KB
nonzero_0 AC 653 ms 60416 KB
nonzero_1 AC 665 ms 68992 KB
nonzero_2 AC 754 ms 90496 KB
nonzero_3 AC 681 ms 68992 KB
nonzero_4 AC 708 ms 71808 KB
nonzero_5 AC 733 ms 91520 KB
nonzero_sc_0 AC 340 ms 256 KB
nonzero_sc_1 AC 482 ms 3968 KB
nonzero_sc_10 AC 652 ms 52608 KB
nonzero_sc_11 AC 604 ms 36736 KB
nonzero_sc_2 AC 493 ms 10368 KB
nonzero_sc_3 AC 580 ms 28160 KB
nonzero_sc_4 AC 603 ms 40448 KB
nonzero_sc_5 AC 682 ms 60032 KB
nonzero_sc_6 AC 356 ms 256 KB
nonzero_sc_7 AC 468 ms 3200 KB
nonzero_sc_8 AC 499 ms 9600 KB
nonzero_sc_9 AC 531 ms 18048 KB
nonzero_small_0 AC 9 ms 1536 KB
nonzero_small_1 AC 1 ms 256 KB
nonzero_small_2 AC 1 ms 256 KB
nonzero_small_3 AC 74 ms 8320 KB
rand_0 AC 1 ms 256 KB
rand_1 AC 1 ms 256 KB
rand_2 AC 1 ms 256 KB
runnur_0 AC 452 ms 3840 KB
runnur_1 AC 415 ms 640 KB
runnur_2 AC 427 ms 1152 KB
runnur_3 AC 421 ms 1152 KB
runnur_4 AC 485 ms 2816 KB