QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#511093 | #1645. 3-colorings | C1942huangjiaxu | AC ✓ | 1ms | 3820kb | C++14 | 673b | 2024-08-09 16:08:29 | 2024-08-09 16:08:29 |
Judging History
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