QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#231521 | #7637. Exactly Three Neighbors | zjy0001 | AC ✓ | 0ms | 3700kb | C++14 | 2.6kb | 2023-10-29 13:36:40 | 2023-10-29 13:36:40 |
Judging History
answer
#include<bits/stdc++.h>
#define LL long long
#define LLL __int128
#define uint unsigned
#define ldb long double
#define uLL unsigned long long
using namespace std;
int wtop,wlen,wstk[40];
char rdc[1<<14],wtc[1<<23],*rS,*rT;
#define gc() (rS==rT?rT=(rS=rdc)+fread(rdc,1,1<<14,stdin),(rS==rT?EOF:*rS++):*rS++)
#define pc(x) wtc[wlen++]=(x)
#define flush() fwrite(wtc,1,wlen,stdout),wlen=0
template<class T=int>inline T read(){
T x=0;char ch;bool f=0;
while(!isdigit(ch=gc()))if(ch=='-')f=!f;
do x=(x<<1)+(x<<3)+(ch^48);while(isdigit(ch=gc()));
return f?-x:x;
}
inline int read(char*const s){
char *t=s,ch;
while(!isgraph(ch=gc()));
do *t++=ch;while(isgraph(ch=gc()));
return *t=0,t-s;
}
template<class T>inline void write(T x){
if(wlen>=8000000)flush();
if(!x)return pc('0'),void();
if(x<0)pc('-'),x=-x;
while(x)wstk[wtop++]=x%10,x/=10;
while(wtop)pc(wstk[--wtop]^48);
}
inline void write(char*const s){
if(wlen>=8000000)flush();
for(int i=0;*(s+i);pc(*(s+(i++))));
}
inline void write(const char*s){
if(wlen>=8000000)flush();
for(int i=0;*(s+i);pc(*(s+(i++))));
}
typedef pair<int,int> PII;
typedef tuple<int,int,int> TIII;
typedef tuple<int,int,int,int> TIIII;
const int N=1e4+5;
signed main(){
int p=read(),q=read();
if(p==0)write("1 1\n.");
else if(p*3<=q*2){
p*=3,q*=2;
pc('1'),pc(' '),write(q),pc('\n');
for(int i=0;i<p;i+=3)pc('#'),pc('#'),pc('.');
for(int i=p;i<q;++i)pc('.');
}
else if(p==3&&q==4){
write("4 4\n");
write(".###\n");
write("##.#\n");
write("##.#\n");
write(".###\n");
}
else if(p==7&&q==10){
write("4 5\n");
write(".####\n");
write("##..#\n");
write("##..#\n");
write(".####\n");
}
else if(p==5&&q==7){
write("4 14\n");
write(".###..###..###\n");
write("##.####.####.#\n");
write("##.####.####.#\n");
write(".###..###..###\n");
}
else if(p==4&&q==5){
write("5 5\n");
write("###.#\n");
write(".####\n");
write("##.##\n");
write("####.\n");
write("#.###\n");
}
else if(p==7&&q==9){
write("6 18\n");
write(".##.####.####.####\n");
write(".####.####.####.##\n");
write("##.####.####.##.##\n");
write("####.####.##.####.\n");
write("#.####.##.####.###\n");
write("###.##.####.####.#\n");
}
else write("-1 -1");
return flush();
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
2 3
output:
1 6 ##.##.
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1 1
output:
-1 -1
result:
ok no solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
3 4
output:
4 4 .### ##.# ##.# .###
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
3 5
output:
1 10 ##.##.##..
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
4 5
output:
5 5 ###.# .#### ##.## ####. #.###
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
7 10
output:
4 5 .#### ##..# ##..# .####
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
5 7
output:
4 14 .###..###..### ##.####.####.# ##.####.####.# .###..###..###
result:
ok good solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
7 9
output:
6 18 .##.####.####.#### .####.####.####.## ##.####.####.##.## ####.####.##.####. #.####.##.####.### ###.##.####.####.#
result:
ok good solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
0 1
output:
1 1 .
result:
ok good solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
1 2
output:
1 4 ##..
result:
ok good solution
Test #11:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
1 3
output:
1 6 ##....
result:
ok good solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 4
output:
1 8 ##......
result:
ok good solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
1 5
output:
1 10 ##........
result:
ok good solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
1 6
output:
1 12 ##..........
result:
ok good solution
Test #15:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 7
output:
1 14 ##............
result:
ok good solution
Test #16:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 8
output:
1 16 ##..............
result:
ok good solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
1 9
output:
1 18 ##................
result:
ok good solution
Test #18:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
1 10
output:
1 20 ##..................
result:
ok good solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
2 5
output:
1 10 ##.##.....
result:
ok good solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 7
output:
1 14 ##.##.........
result:
ok good solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 9
output:
1 18 ##.##.............
result:
ok good solution
Test #22:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
3 7
output:
1 14 ##.##.##......
result:
ok good solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3 8
output:
1 16 ##.##.##........
result:
ok good solution
Test #24:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
3 10
output:
1 20 ##.##.##............
result:
ok good solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
4 7
output:
1 14 ##.##.##.##...
result:
ok good solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
4 9
output:
1 18 ##.##.##.##.......
result:
ok good solution
Test #27:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
5 6
output:
-1 -1
result:
ok no solution
Test #28:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 8
output:
1 16 ##.##.##.##.##..
result:
ok good solution
Test #29:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 9
output:
1 18 ##.##.##.##.##....
result:
ok good solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
6 7
output:
-1 -1
result:
ok no solution
Test #31:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
7 8
output:
-1 -1
result:
ok no solution
Test #32:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8 9
output:
-1 -1
result:
ok no solution
Test #33:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
9 10
output:
-1 -1
result:
ok no solution
Extra Test:
score: 0
Extra Test Passed