QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#242043 | #7637. Exactly Three Neighbors | SolitaryDream | AC ✓ | 0ms | 3708kb | C++17 | 2.1kb | 2023-11-06 21:29:15 | 2023-11-06 21:29:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int p,q;
cin >> p >> q;
if(p*3<=q*2) {
cout << 1 << ' ' << 2*q << '\n';
FOR(i,1,p) {
cout << "##.";
}
FOR(i,1,2*q-p*3) {
cout << '.';
}
cout << '\n';
} else if(p==3 && q==4) {
cout << "4 4\n";
cout << "####\n";
cout << "##..\n";
cout << "####\n";
cout << "..##\n";
} else if(p==7 && q==10) {
cout << "4 5\n";
cout << "####.\n";
cout << "####.\n";
cout << "#..##\n";
cout << "#..##\n";
} else if(p==4 && q==5) {
cout << "5 5\n";
cout << "####.\n";
cout << "##.##\n";
cout << ".####\n";
cout << "###.#\n";
cout << "#.###\n";
} else if(p==5 && q==7) {
cout << "6 7\n";
cout << "######.\n";
cout << "##..##.\n";
cout << "##..##.\n";
cout << "######.\n";
cout << "#.##.##\n";
cout << "#.##.##\n";
} else if (p==7 && q==9) {
static char mp[100][101];
for (int i = 0; i < 100; ++i)
for (int j = 0; j < 100; ++j)
mp[i][j] = '#';
for (int i = 50, j = 5; i < 90; i += 1, j += 3) {
for (int ni = i, nj = j; ni >= 10 && nj < 90; ni -= 4, nj += 6) {
mp[ni][nj] = '.';
mp[ni + 1][nj + 0] = '.';
mp[ni - 1][nj + 2] = '.';
mp[ni - 2][nj + 4] = '.';
}
}
cout << 6 << ' ' << 18 << endl;
for (int i = 50; i < 50 + 6; cout << '\n', ++i)
for (int j = 30; j < 30 + 18; ++j)
cout << mp[i][j];
} else {
cout << "-1 -1\n";
}
return 0;
}
/*
#
##*# #
##*####*# #
#*####*### #*#
#*##*####* ##
###*##*##
#*####*##
# #*###*#
##*####*#
*####*###
*##*####*
###*##*##
#*####*##
*/ #
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3540kb
input:
2 3
output:
1 6 ##.##.
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3680kb
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: 3648kb
input:
3 5
output:
1 10 ##.##.##..
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
4 5
output:
5 5 ####. ##.## .#### ###.# #.###
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
7 10
output:
4 5 ####. ####. #..## #..##
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 7
output:
6 7 ######. ##..##. ##..##. ######. #.##.## #.##.##
result:
ok good solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
7 9
output:
6 18 ###.####.##.####.# #.####.####.##.### ####.####.####.##. ##.####.####.####. ##.##.####.####.## .####.##.####.####
result:
ok good solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
0 1
output:
1 2 ..
result:
ok good solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
1 2
output:
1 4 ##..
result:
ok good solution
Test #11:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1 3
output:
1 6 ##....
result:
ok good solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 4
output:
1 8 ##......
result:
ok good solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1 5
output:
1 10 ##........
result:
ok good solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1 6
output:
1 12 ##..........
result:
ok good solution
Test #15:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 7
output:
1 14 ##............
result:
ok good solution
Test #16:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1 8
output:
1 16 ##..............
result:
ok good solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
1 9
output:
1 18 ##................
result:
ok good solution
Test #18:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 10
output:
1 20 ##..................
result:
ok good solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 5
output:
1 10 ##.##.....
result:
ok good solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
2 7
output:
1 14 ##.##.........
result:
ok good solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
2 9
output:
1 18 ##.##.............
result:
ok good solution
Test #22:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
3 7
output:
1 14 ##.##.##......
result:
ok good solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 8
output:
1 16 ##.##.##........
result:
ok good solution
Test #24:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
3 10
output:
1 20 ##.##.##............
result:
ok good solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
4 7
output:
1 14 ##.##.##.##...
result:
ok good solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4 9
output:
1 18 ##.##.##.##.......
result:
ok good solution
Test #27:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
5 6
output:
-1 -1
result:
ok no solution
Test #28:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
5 8
output:
1 16 ##.##.##.##.##..
result:
ok good solution
Test #29:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 9
output:
1 18 ##.##.##.##.##....
result:
ok good solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
6 7
output:
-1 -1
result:
ok no solution
Test #31:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
7 8
output:
-1 -1
result:
ok no solution
Test #32:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
8 9
output:
-1 -1
result:
ok no solution
Test #33:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
9 10
output:
-1 -1
result:
ok no solution
Extra Test:
score: 0
Extra Test Passed