QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227066#5413. 同构判定鸡chenxinyang200615 3ms4140kbC++141.8kb2023-10-26 20:49:362023-10-26 20:49:36

Judging History

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

  • [2023-10-26 20:49:36]
  • 评测
  • 测评结果:15
  • 用时:3ms
  • 内存:4140kb
  • [2023-10-26 20:49:36]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;

template <class T>
void chkmax(T &x,T y){
	if(x < y) x = y;
}

template <class T>
void chkmin(T &x,T y){
	if(x > y) x = y;
}

inline int popcnt(int x){
	return __builtin_popcount(x);
}

inline int ctz(int x){
	return __builtin_ctz(x);
}


/*ll power(ll p,int k = mod - 2){
	ll ans = 1;
	while(k){
		if(k % 2 == 1) ans = ans * p % mod;
		p = p * p % mod;
		k /= 2;	
	}
	return ans;
}*/
int T,type;
int N,M;

int readtrash(){
	int n,m,p,q;
	scanf("%d%d",&n,&m);
	rep(i,1,m) scanf("%d%d",&p,&q);
	return n;
}

vector <pii> ans;
void solve1(int k){
	scanf("%d%d",&N,&M);
	ans.clear();
	rep(u,1,N){
		rep(v,u + 1,N) if(u % k != v % k) ans.eb(mkp(u,v));
	}	
	printf("%d %d\n",N,SZ(ans));
	for(pii I:ans) printf("%d %d\n",I.first,I.second);
	assert(SZ(ans) >= M);
}

void solve2(){
	ans.clear();
	int p = 53;
	rep(d,0,p - 1){
		rep(s,1,p){
			int cur = s,nxt;
			rep(i,1,p){
				nxt = (cur + d) % p;
				if(!nxt) nxt = p;
				if(i % 2 == 1 && i < p) ans.eb(mkp(cur + (i - 1) * p,nxt + i * p));
				cur = nxt;
			}
		}		
	}
	printf("%d %d\n",p * p,SZ(ans));
	for(pii I:ans) printf("%d %d\n",I.first,I.second);
}

int main(){
	scanf("%d%d",&T,&type);
	if(type <= 2){
		while(T--) solve1(readtrash() - 1);
	}
	if(type == 5){
		solve2();
	}
	return 0;
}

詳細信息

Test #1:

score: 5
Accepted
time: 1ms
memory: 3852kb

input:

10 1
3 3
1 2
1 3
2 3
33 272
3 3
1 2
1 3
2 3
28 196
3 3
1 2
1 3
2 3
92 2116
3 3
1 2
1 3
2 3
29 210
3 3
1 2
1 3
2 3
62 961
3 3
1 2
1 3
2 3
97 2352
3 3
1 2
1 3
2 3
60 900
3 3
1 2
1 3
2 3
70 1225
3 3
1 2
1 3
2 3
67 1122
3 3
1 2
1 3
2 3
67 1122

output:

33 272
1 2
1 4
1 6
1 8
1 10
1 12
1 14
1 16
1 18
1 20
1 22
1 24
1 26
1 28
1 30
1 32
2 3
2 5
2 7
2 9
2 11
2 13
2 15
2 17
2 19
2 21
2 23
2 25
2 27
2 29
2 31
2 33
3 4
3 6
3 8
3 10
3 12
3 14
3 16
3 18
3 20
3 22
3 24
3 26
3 28
3 30
3 32
4 5
4 7
4 9
4 11
4 13
4 15
4 17
4 19
4 21
4 23
4 25
4 27
4 29
4 31
4 ...

result:

ok correct! (10 test cases)

Test #2:

score: 10
Accepted
time: 1ms
memory: 3820kb

input:

10 2
5 10
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5
28 293
8 28
1 2
1 3
1 4
1 5
1 6
1 7
1 8
2 3
2 4
2 5
2 6
2 7
2 8
3 4
3 5
3 6
3 7
3 8
4 5
4 6
4 7
4 8
5 6
5 7
5 8
6 7
6 8
7 8
8 26
4 6
1 2
1 3
1 4
2 3
2 4
3 4
82 2240
3 3
1 2
1 3
2 3
46 528
4 6
1 2
1 3
1 4
2 3
2 4
3 4
42 587
9 36
1 2
1 3
1 4
1 5
1 6
1 ...

output:

28 294
1 2
1 3
1 4
1 6
1 7
1 8
1 10
1 11
1 12
1 14
1 15
1 16
1 18
1 19
1 20
1 22
1 23
1 24
1 26
1 27
1 28
2 3
2 4
2 5
2 7
2 8
2 9
2 11
2 12
2 13
2 15
2 16
2 17
2 19
2 20
2 21
2 23
2 24
2 25
2 27
2 28
3 4
3 5
3 6
3 8
3 9
3 10
3 12
3 13
3 14
3 16
3 17
3 18
3 20
3 21
3 22
3 24
3 25
3 26
3 28
4 5
4 6
4 ...

result:

ok correct! (10 test cases)

Test #3:

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

input:

10 3
4 4
1 2
2 3
3 4
4 1
387 774
4 4
1 2
2 3
3 4
4 1
668 1336
4 4
1 2
2 3
3 4
4 1
1403 2806
4 4
1 2
2 3
3 4
4 1
1516 3032
4 4
1 2
2 3
3 4
4 1
1601 3202
4 4
1 2
2 3
3 4
4 1
1649 3298
4 4
1 2
2 3
3 4
4 1
1722 3444
4 4
1 2
2 3
3 4
4 1
1854 3708
4 4
1 2
2 3
3 4
4 1
1926 3852
4 4
1 2
2 3
3 4
4 1
1989 3978

output:


result:

wrong output format Unexpected end of file - int32 expected (test case 1)

Test #4:

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

input:

10 4
4 4
1 2
2 3
3 4
4 1
169 1014
4 4
1 2
2 3
3 4
4 1
529 5819
4 4
1 2
2 3
3 4
4 1
841 11774
4 4
1 2
2 3
3 4
4 1
961 14415
4 4
1 2
2 3
3 4
4 1
1369 24642
4 4
1 2
2 3
3 4
4 1
1681 33620
4 4
1 2
2 3
3 4
4 1
1849 38829
4 4
1 2
2 3
3 4
4 1
361 3249
4 4
1 2
2 3
3 4
4 1
289 2312
4 4
1 2
2 3
3 4
4 1
9 9

output:


result:

wrong output format Unexpected end of file - int32 expected (test case 1)

Test #5:

score: 0
Wrong Answer
time: 3ms
memory: 4140kb

input:

1 5
4 4
1 2
2 3
3 4
4 1
2850 24300

output:

2809 73034
1 54
107 160
213 266
319 372
425 478
531 584
637 690
743 796
849 902
955 1008
1061 1114
1167 1220
1273 1326
1379 1432
1485 1538
1591 1644
1697 1750
1803 1856
1909 1962
2015 2068
2121 2174
2227 2280
2333 2386
2439 2492
2545 2598
2651 2704
2 55
108 161
214 267
320 373
426 479
532 585
638 69...

result:

wrong answer wrong answer!

Test #6:

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

input:

1 6
6 9
1 4
1 5
1 6
2 4
2 5
2 6
3 4
3 5
3 6
343 2350

output:


result:

wrong output format Unexpected end of file - int32 expected