QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#423214#8729. TikvaniCrysfly0 1ms3820kbC++172.7kb2024-05-27 21:34:392024-05-27 21:34:40

Judging History

This is the latest submission verdict.

  • [2024-05-27 21:34:40]
  • Judged
  • Verdict: 0
  • Time: 1ms
  • Memory: 3820kb
  • [2024-05-27 21:34:39]
  • Submitted

answer

// what is matter? never mind. 
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define mod 1000000007
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,modint b){return a.x==b.x;}
	friend bool operator !=(modint a,modint b){return a.x!=b.x;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 505
#define inf 0x3f3f3f3f

int n,m,e[maxn][maxn];

bool add(int u,int v){
	For(i,1,u) if(e[i][u])
		For(j,v,n) if(e[v][j] && e[i][j]) return 0;
	For(i,1,u) if(e[i][u])
		For(j,v,n) if(e[v][j]) e[i][j]=1;
	return 1;
}

signed main()
{
	n=read(),m=read();
	For(i,1,n) e[i][i]=1;
	int res=0;
	For(i,1,m){
		int u=read(),v=read();
		if(add(u,v)) ++res;
	}
	cout<<qpow(2,res).x;
	return 0;
}
/*

*/

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 21
Accepted
time: 1ms
memory: 3668kb

input:

6 5
3 5
2 5
1 6
4 6
2 6

output:

32

result:

ok 1 number(s): "32"

Test #2:

score: 21
Accepted
time: 0ms
memory: 3736kb

input:

6 6
2 5
1 2
3 4
5 6
3 6
1 5

output:

32

result:

ok 1 number(s): "32"

Test #3:

score: 21
Accepted
time: 0ms
memory: 3672kb

input:

6 7
3 6
1 3
3 5
2 3
1 6
2 6
2 5

output:

16

result:

ok 1 number(s): "16"

Test #4:

score: 21
Accepted
time: 0ms
memory: 3724kb

input:

6 8
1 4
2 3
5 6
3 6
4 5
2 6
4 6
1 5

output:

32

result:

ok 1 number(s): "32"

Test #5:

score: 21
Accepted
time: 0ms
memory: 3544kb

input:

6 7
1 4
3 6
2 3
1 5
2 4
2 6
5 6

output:

64

result:

ok 1 number(s): "64"

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 3608kb

input:

6 8
2 3
2 4
2 5
3 6
1 6
1 2
1 4
1 5

output:

128

result:

wrong answer 1st numbers differ - expected: '32', found: '128'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #25:

score: 37
Accepted
time: 0ms
memory: 3820kb

input:

50 50
29 32
3 12
36 41
10 30
6 18
20 27
14 36
4 33
6 7
17 31
33 40
2 49
19 42
3 30
2 18
11 42
21 29
11 23
1 35
32 50
22 46
6 22
42 48
15 23
7 43
11 13
5 9
40 50
25 42
5 31
27 30
1 17
14 48
5 44
35 41
1 23
10 21
40 48
12 36
13 37
23 37
23 43
19 26
6 15
13 45
19 27
17 29
20 38
29 42
26 49

output:

974740338

result:

ok 1 number(s): "974740338"

Test #26:

score: 0
Wrong Answer
time: 0ms
memory: 3632kb

input:

49 50
23 42
22 30
8 18
28 42
14 37
34 40
11 34
2 5
9 14
24 34
11 32
41 45
8 28
6 23
9 17
22 31
20 38
4 47
2 39
13 22
14 26
8 45
37 45
17 23
34 37
13 37
33 48
5 12
17 37
27 30
17 21
18 22
28 43
10 23
33 43
31 49
10 43
8 26
12 19
14 28
6 14
2 20
12 49
26 39
35 45
14 48
3 6
14 36
6 48
1 17

output:

487370169

result:

wrong answer 1st numbers differ - expected: '743685088', found: '487370169'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%