QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511093#1645. 3-coloringsC1942huangjiaxuAC ✓1ms3820kbC++14673b2024-08-09 16:08:292024-08-09 16:08:29

Judging History

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

  • [2024-08-09 16:08:29]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3820kb
  • [2024-08-09 16:08:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n=19,k=500;
vector<pair<int,int> >E;
void adde(int x,int y){
	E.emplace_back(x,y);
}
int main(){
	adde(1,2),adde(1,3),adde(2,3);
	for(int i=4;i<=11;++i)adde((i-1)%3+1,i);
	for(int i=4;i<11;++i)adde(i,i+1);
	printf("%d %d\n",n,E.size());
	for(auto [x,y]:E)printf("%d %d\n",x,y);
	for(int i=1;i<=k;++i){
		E.clear();
		int u=i,v=11,w=3;
		while(!(u&1))adde(++v,1),u>>=1;
		while(u>1){
			if(u&1)++w;
			adde(++v,w);
			adde(v,w%3+1);
			u>>=1;
		}
		if(w<11)++w,adde(w,w%3+1);
		while(v<19)adde(++v,1),adde(v,2);
		printf("%d\n",E.size());
		for(auto [x,y]:E)printf("%d %d\n",x,y);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

19 18
1 2
1 3
2 3
1 4
2 5
3 6
1 7
2 8
3 9
1 10
2 11
4 5
5 6
6 7
7 8
8 9
9 10
10 11
17
4 2
12 1
12 2
13 1
13 2
14 1
14 2
15 1
15 2
16 1
16 2
17 1
17 2
18 1
18 2
19 1
19 2
16
12 1
4 2
13 1
13 2
14 1
14 2
15 1
15 2
16 1
16 2
17 1
17 2
18 1
18 2
19 1
19 2
17
12 4
12 2
5 3
13 1
13 2
14 1
14 2
15 1
15 2
1...

result:

ok Correct