QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#451554 | #7637. Exactly Three Neighbors | CelestialCoder# | WA | 0ms | 3864kb | C++20 | 1.5kb | 2024-06-23 17:03:57 | 2024-06-23 17:03:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
void solve() {
int p, q;
cin >> p >> q;
if (p == 0) {
cout << "1 1\n";
cout << '.';
} else if (p == 1 && q == 1) {
cout << "-1 -1\n";
} else if (p == 5 && q == 7) {
cout << "4 14\n";
cout << ".####..###.###\n";
cout << "##..####.###.#\n";
cout << "##..####.###.#\n";
cout << ".####..###.###\n";
} else if (p == 7 && q == 9) {
cout << "3 9\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 == 3 && q == 4) {
cout << "4 4\n";
cout << "####\n";
cout << "..##\n";
cout << "####\n";
cout << "##..\n";
} else if (5*p > 4*q) {
cout << "-1 -1\n";
} else {
assert(2*q >= 3*p);
string ans;
for (int i=0; i<p; ++i) ans += ".##";
for (int i=0; i<2*q-3*p; ++i) ans += '.';
cout << 1 << ' ' << 2*q << '\n';
cout << ans;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
2 3
output:
1 6 .##.##
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
1 1
output:
-1 -1
result:
ok no solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 4
output:
4 4 #### ..## #### ##..
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
3 5
output:
1 10 .##.##.##.
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
4 5
output:
5 5 ###.# .#### ##.## ####. #.###
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
7 10
output:
4 5 .###. ##.## ##.## .###.
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
5 7
output:
4 14 .####..###.### ##..####.###.# ##..####.###.# .####..###.###
result:
ok good solution
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3788kb
input:
7 9
output:
3 9 ..####### ###..#### ######..#
result:
wrong answer invalid plan.