QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#463670#8729. Tikvanihonglan03010 1ms3844kbC++175.2kb2024-07-05 10:55:082024-07-05 10:55:08

Judging History

你现在查看的是最新测评结果

  • [2024-07-05 10:55:08]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3844kb
  • [2024-07-05 10:55:08]
  • 提交

answer

/*
  author: honglan0301
  Sexy_goodier _ xiaoqing
 */
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <queue>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <cmath>
#include <random>
#include <set>
#include <bitset>
#include <assert.h>
using namespace std;

//namespace Fread{const int SIZE=1<<20;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return*S++;}}using namespace Fread;namespace Fwrite{const int SIZE=1<<20;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}using namespace Fwrite;
//#define getchar Fread::getchar
//#define putchar Fwrite::putchar

namespace Fastio{struct Reader{template<typename T>Reader&operator>>(T&x){x=0;short f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();x*=f;return*this;}Reader&operator>>(double&x){x=0;double t=0;short f=1,s=0;char c=getchar();while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else{x*=f;return*this;}while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}Reader&operator>>(long double&x){x=0;long double t=0;short f=1,s=0;char c=getchar();while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else{x*=f;return*this;}while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}Reader&operator>>(__float128&x){x=0;__float128 t=0;short f=1,s=0;char c=getchar();while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else{x*=f;return*this;}while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}Reader&operator>>(char&c){c=getchar();while(c==' '||c=='\n'||c=='\r')c=getchar();return*this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c==' '||c=='\n'||c=='\r')c=getchar();while(c!=' '&&c!='\n'&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}Reader&operator>>(string&str){str.clear();char c=getchar();while(c==' '||c=='\n'||c=='\r')c=getchar();while(c!=' '&&c!='\n'&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';struct Writer{const int Setprecision=6;typedef int mxdouble;template<typename T>Writer&operator<<(T x){if(x==0){putchar('0');return*this;}if(x<0)putchar('-'),x=-x;static short sta[40];short top=0;while(x>0)sta[++top]=x%10,x/=10;while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(double x){if(x<0)putchar('-'),x=-x;mxdouble _=x;x-=(double)_;static short sta[40];short top=0;while(_>0)sta[++top]=_%10,_/=10;if(top==0)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_>0)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(long double x){if(x<0)putchar('-'),x=-x;mxdouble _=x;x-=(long double)_;static short sta[40];short top=0;while(_>0)sta[++top]=_%10,_/=10;if(top==0)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_>0)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(__float128 x){if(x<0)putchar('-'),x=-x;mxdouble _=x;x-=(__float128)_;static short sta[40];short top=0;while(_>0)sta[++top]=_%10,_/=10;if(top==0)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;putchar('.');for(int i=0;i<Setprecision;i++)x*=10;_=x;while(_>0)sta[++top]=_%10,_/=10;for(int i=0;i<Setprecision-top;i++)putchar('0');while(top>0)putchar(sta[top]+'0'),top--;return*this;}Writer&operator<<(char c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}Writer&operator<<(string str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}using namespace Fastio;
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl//;fflush(stdout)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define int long long
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define G 3
#define Gi 332748118
mt19937 rnd(time(0));
mt19937_64 rndl(time(0));

int ksm(int x,int k) {int na=1; for(int i=1;i<=k;i<<=1) {if(i&k) na=na*x%mod; x=x*x%mod;} return na;}

int n,m,u,v,ans;
bitset <505> e[505],ne[505];

signed main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>u>>v,e[u][v]=1;
	for(int i=1;i<=n;i++) e[i][i]=1;
	for(int k=1;k<=n;k++) for(int i=1;i<=n;i++) if(e[i][k]) e[i]|=e[k];
	for(int i=n;i>=1;i--)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(e[i][j]&&!ne[i][j]) ne[i]|=e[j],ans++;
		}
	}
	cout<<ksm(2,ans)<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

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

output:

32

result:

ok 1 number(s): "32"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3844kb

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: 0
Accepted
time: 0ms
memory: 3712kb

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: 0
Accepted
time: 0ms
memory: 3600kb

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: 0
Accepted
time: 0ms
memory: 3796kb

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
Accepted
time: 0ms
memory: 3604kb

input:

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

output:

32

result:

ok 1 number(s): "32"

Test #7:

score: -21
Wrong Answer
time: 0ms
memory: 3716kb

input:

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

output:

64

result:

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

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #25:

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

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:

898961331

result:

wrong answer 1st numbers differ - expected: '974740338', found: '898961331'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%