QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#232615 | #7637. Exactly Three Neighbors | mendicillin2# | AC ✓ | 1ms | 3712kb | C++17 | 3.0kb | 2023-10-30 17:38:12 | 2023-10-30 17:38:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define F(i, j, k) for (int i = j ; i <= k; ++i)
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
int n, m; cin >> n >> m;
if (1.0 * n / m > 0.8) { cout << "-1 -1" << endl; return 0; }
if (1.0 * n / m <= 2.0 / 3) {
n <<= 1; m <<= 1;
cout << 1 << " " << m << endl;
F(i, 1, m) if ((i % 3 == 1 || i % 3 == 2) && n > 0) { putchar('#'); --n; } else putchar('.');
puts("");
return 0;
}
if (n == 4 && m == 5) {
cout << "5 5" << endl;
cout << ".####" << endl;
cout << "##.##" << endl;
cout << "####." << endl;
cout << "#.###" << endl;
cout << "###.#" << endl;
}
if (n == 3 && m == 4) {
cout << "8 8" << endl;
cout << "..######" << endl;
cout << "###..###" << endl;
cout << "######.." << endl;
cout << "#..#####" << endl;
cout << "####..##" << endl;
cout << ".######." << endl;
cout << "##..####" << endl;
cout << "#####..#" << endl;
}
if (n == 5 && m == 7) {
cout << "14 14" << endl;
cout << "....##########" << endl;
cout << "#####....#####" << endl;
cout << "##########...." << endl;
cout << "#....#########" << endl;
cout << "######....####" << endl;
cout << ".##########..." << endl;
cout << "##....########" << endl;
cout << "#######....###" << endl;
cout << "..##########.." << endl;
cout << "###....#######" << endl;
cout << "########....##" << endl;
cout << "...##########." << endl;
cout << "####....######" << endl;
cout << "#########....#" << endl;
}
if (n == 7 && m == 10) {
cout << "20 20" << endl;
cout << "......##############" << endl;
cout << "#######......#######" << endl;
cout << "##############......" << endl;
cout << "#......#############" << endl;
cout << "########......######" << endl;
cout << ".##############....." << endl;
cout << "##......############" << endl;
cout << "#########......#####" << endl;
cout << "..##############...." << endl;
cout << "###......###########" << endl;
cout << "##########......####" << endl;
cout << "...##############..." << endl;
cout << "####......##########" << endl;
cout << "###########......###" << endl;
cout << "....##############.." << endl;
cout << "#####......#########" << endl;
cout << "############......##" << endl;
cout << ".....##############." << endl;
cout << "######......########" << endl;
cout << "#############......#" << endl;
}
if (n == 7 && m == 9) {
cout << "18 6" << endl;
cout << "#####." << endl;
cout << "#..###" << endl;
cout << "####.#" << endl;
cout << ".#####" << endl;
cout << "##..##" << endl;
cout << "#####." << endl;
cout << "#.####" << endl;
cout << "###..#" << endl;
cout << ".#####" << endl;
cout << "##.###" << endl;
cout << "####.." << endl;
cout << "#.####" << endl;
cout << "###.##" << endl;
cout << ".####." << endl;
cout << "##.###" << endl;
cout << "####.#" << endl;
cout << "..####" << endl;
cout << "###.##" << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3644kb
input:
2 3
output:
1 6 ##.##.
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
1 1
output:
-1 -1
result:
ok no solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
3 4
output:
8 8 ..###### ###..### ######.. #..##### ####..## .######. ##..#### #####..#
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
3 5
output:
1 10 ##.##.##..
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
4 5
output:
5 5 .#### ##.## ####. #.### ###.#
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
7 10
output:
20 20 ......############## #######......####### ##############...... #......############# ########......###### .##############..... ##......############ #########......##### ..##############.... ###......########### ##########......#### ...##############... ####......########## ###########......### ...
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
5 7
output:
14 14 ....########## #####....##### ##########.... #....######### ######....#### .##########... ##....######## #######....### ..##########.. ###....####### ########....## ...##########. ####....###### #########....#
result:
ok good solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
7 9
output:
18 6 #####. #..### ####.# .##### ##..## #####. #.#### ###..# .##### ##.### ####.. #.#### ###.## .####. ##.### ####.# ..#### ###.##
result:
ok good solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
0 1
output:
1 2 ..
result:
ok good solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3700kb
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: 3624kb
input:
1 4
output:
1 8 ##......
result:
ok good solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
1 5
output:
1 10 ##........
result:
ok good solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
1 6
output:
1 12 ##..........
result:
ok good solution
Test #15:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 7
output:
1 14 ##............
result:
ok good solution
Test #16:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
1 8
output:
1 16 ##..............
result:
ok good solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
1 9
output:
1 18 ##................
result:
ok good solution
Test #18:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1 10
output:
1 20 ##..................
result:
ok good solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
2 5
output:
1 10 ##.##.....
result:
ok good solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
2 7
output:
1 14 ##.##.........
result:
ok good solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 9
output:
1 18 ##.##.............
result:
ok good solution
Test #22:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
3 7
output:
1 14 ##.##.##......
result:
ok good solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
3 8
output:
1 16 ##.##.##........
result:
ok good solution
Test #24:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
3 10
output:
1 20 ##.##.##............
result:
ok good solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
4 7
output:
1 14 ##.##.##.##...
result:
ok good solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
4 9
output:
1 18 ##.##.##.##.......
result:
ok good solution
Test #27:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
5 6
output:
-1 -1
result:
ok no solution
Test #28:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 8
output:
1 16 ##.##.##.##.##..
result:
ok good solution
Test #29:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
5 9
output:
1 18 ##.##.##.##.##....
result:
ok good solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
6 7
output:
-1 -1
result:
ok no solution
Test #31:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
7 8
output:
-1 -1
result:
ok no solution
Test #32:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
8 9
output:
-1 -1
result:
ok no solution
Test #33:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
9 10
output:
-1 -1
result:
ok no solution
Extra Test:
score: 0
Extra Test Passed