Submission #1778033


Source Code Expand

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
int n,m; bool edg[55][55];
ll f[2333333];
#define ff(i) (((i)&1)==bool((i)&2))
const int MOD=1e9+7;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,a,b;i<=m;++i)
		scanf("%d%d",&a,&b),edg[a-1][b-1]=1;
	for(int i=0;i<(1<<n);++i)
	{
		if(!ff(i)) continue;
		cout<<i<<"!\n";
		f[i]=1;
		for(int g=i;g;g=(g-1)&i) if(g!=i&&ff(g))
		{
			int s=g^i; ll aa=1;
			for(int j=0;j<n;++j) if(g&(1<<j))
			{
				int d=0,d2=0;
				for(int k=0;k<n;++k) if(s&(1<<k))
					d+=edg[j][k];
				for(int k=0;k<n;++k) if(s&(1<<k))
					d2+=edg[k][j];
				aa*=(1LL<<d)-1; aa%=MOD;
				aa*=1LL<<d2; aa%=MOD;
			}
			f[i]+=aa*f[g]%MOD;
		}
	}
	ll ans=1;
	for(int i=1;i<=m;++i) ans=ans*2%MOD;
	ans=ans-f[(1<<n)-1];
	ans=(ans%MOD+MOD)%MOD;
	printf("%d\n",int(ans));
}

Submission Info

Submission Time
Task A - Shrinking
User fjzzq2002
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1811 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:38:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
                     ^
./Main.cpp:40:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&a,&b),edg[a-1][b-1]=1;
                                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 4
WA × 14
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt
Case Name Status Exec Time Memory
0_00.txt WA 1 ms 256 KB
0_01.txt WA 1 ms 256 KB
0_02.txt WA 1 ms 256 KB
0_03.txt WA 1 ms 256 KB
1_00.txt WA 1 ms 256 KB
1_01.txt WA 1 ms 256 KB
1_02.txt WA 1 ms 256 KB
1_03.txt WA 1 ms 256 KB
1_04.txt WA 1 ms 256 KB
1_05.txt WA 1 ms 256 KB
1_06.txt WA 1 ms 256 KB
1_07.txt WA 1 ms 256 KB
1_08.txt WA 1 ms 256 KB
1_09.txt WA 1 ms 256 KB