Submission #11061438


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>
#include <assert.h>
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])
const int MOD=998244353;
#define SZ 666666
int n;
struct G
{
vector<int> v[SZ];
int sg[SZ];
bool b[SZ];
void dfs(int x)
{
	if(b[x]) return;
	b[x]=1;
	set<int> sp;
	for(auto bb:v[x])
	{
		dfs(bb);
		sp.insert(sg[bb]);
	}
	sg[x]=0;
	while(sp.count(sg[x]))
		++sg[x];
}
void ip()
{
	int m;
	scanf("%d",&m);
	while(m--)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		if(a>b) swap(a,b);
		v[a].pb(b);
	}
	for(int i=n;i>=1;--i) dfs(i);
}
}T[3];
ll qp(ll a,ll b)
{
	ll x=1; a%=MOD;
	while(b)
	{
		if(b&1) x=x*a%MOD;
		a=a*a%MOD; b>>=1;
	}
	return x;
}
map<int,int> c[3];
int main()
{
	scanf("%d",&n);
	ll x[2]={1,0};
	for(int i=0;i<3;++i)
	{
		T[i].ip();
		for(int j=1;j<=n;++j) (c[i][T[i].sg[j]]+=qp(1e18,j))%=MOD;
	}
	ll ans=0;
	for(auto i_:c[0])
		for(auto j_:c[1])
		{
			int i=i_.fi,j=j_.fi;
			ans+=c[0][i]*(ll)c[1][j]%MOD*c[2][i^j]%MOD;
		}
	cout<<(ans%MOD+MOD)%MOD<<"\n";
}

Submission Info

Submission Time
Task C - Giant Graph
User fjzzq2002
Language C++14 (GCC 5.4.1)
Score 900
Code Size 1991 Byte
Status AC
Exec Time 155 ms
Memory 61056 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:82:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
./Main.cpp: In member function ‘void G::ip()’:
./Main.cpp:58:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&m);
                ^
./Main.cpp:62:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&a,&b);
                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 900 / 900
Status
AC × 3
AC × 45
Set Name Test Cases
Sample example_00, example_01, example_02
All clique_00, clique_01, clique_02, example_00, example_01, example_02, max_clique_00, max_clique_01, max_clique_02, max_random_00, max_random_01, max_random_02, quite_small_00, quite_small_01, quite_small_02, quite_small_03, quite_small_04, quite_small_05, quite_small_06, quite_small_07, quite_small_08, quite_small_09, random_00, random_01, random_02, small_clique_00, small_clique_01, small_clique_02, small_clique_03, small_clique_04, small_clique_05, small_clique_06, small_clique_07, small_clique_08, small_clique_09, small_random_00, small_random_01, small_random_02, small_random_03, small_random_04, small_random_05, small_random_06, small_random_07, small_random_08, small_random_09
Case Name Status Exec Time Memory
clique_00 AC 108 ms 55040 KiB
clique_01 AC 86 ms 54400 KiB
clique_02 AC 77 ms 54272 KiB
example_00 AC 24 ms 53504 KiB
example_01 AC 24 ms 53504 KiB
example_02 AC 52 ms 55680 KiB
max_clique_00 AC 155 ms 57344 KiB
max_clique_01 AC 155 ms 57344 KiB
max_clique_02 AC 155 ms 57344 KiB
max_random_00 AC 152 ms 61056 KiB
max_random_01 AC 151 ms 61056 KiB
max_random_02 AC 151 ms 61056 KiB
quite_small_00 AC 25 ms 53504 KiB
quite_small_01 AC 25 ms 53504 KiB
quite_small_02 AC 24 ms 53504 KiB
quite_small_03 AC 24 ms 53504 KiB
quite_small_04 AC 25 ms 53504 KiB
quite_small_05 AC 24 ms 53504 KiB
quite_small_06 AC 25 ms 53504 KiB
quite_small_07 AC 25 ms 53504 KiB
quite_small_08 AC 25 ms 53504 KiB
quite_small_09 AC 24 ms 53504 KiB
random_00 AC 79 ms 55296 KiB
random_01 AC 76 ms 55552 KiB
random_02 AC 84 ms 56064 KiB
small_clique_00 AC 38 ms 53760 KiB
small_clique_01 AC 38 ms 53760 KiB
small_clique_02 AC 27 ms 53504 KiB
small_clique_03 AC 37 ms 53760 KiB
small_clique_04 AC 33 ms 53760 KiB
small_clique_05 AC 31 ms 53632 KiB
small_clique_06 AC 30 ms 53632 KiB
small_clique_07 AC 38 ms 53760 KiB
small_clique_08 AC 36 ms 53760 KiB
small_clique_09 AC 29 ms 53632 KiB
small_random_00 AC 37 ms 53888 KiB
small_random_01 AC 38 ms 53760 KiB
small_random_02 AC 29 ms 53632 KiB
small_random_03 AC 35 ms 53760 KiB
small_random_04 AC 30 ms 53632 KiB
small_random_05 AC 33 ms 53760 KiB
small_random_06 AC 35 ms 53760 KiB
small_random_07 AC 33 ms 53760 KiB
small_random_08 AC 34 ms 53760 KiB
small_random_09 AC 30 ms 53632 KiB