QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#245352 | #7637. Exactly Three Neighbors | ucup-team2307# | WA | 0ms | 3812kb | C++17 | 3.2kb | 2023-11-09 20:56:12 | 2023-11-09 20:56:14 |
Judging History
answer
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std;
bool ask(int p, int q)
{
if (p*5 >= q*4)
{
if (p*5 == q*4)
{
cout<<5<<" "<<5<<"\n";
cout<<"###.#\n";
cout<<"#.###\n";
cout<<"####.\n";
cout<<"##.##\n";
cout<<".####\n";
}
else
{
cout<<-1<<" "<<-1<<"\n";
}
return true;
}
if (p==2)
{
cout<<1<<" "<<q<<"\n";
cout<<"##"<<string(q-2, '.');
cout<<"\n";
return true;
}
for (int x=0; x<=100; x++)
for (int k=1; k<=100; k++)
if (p*(2*x+8*k) == q*(x+6*k))
{
cout<<x+4*k<<" "<<4<<"\n";
for (int i=0; i<x; i++)
cout<<".##.\n";
for (int i=0; i<k; i++)
{
cout<<".##.\n";
cout<<"####\n";
cout<<"#..#\n";
cout<<"####\n";
}
return true;
}
for (int x=0; x<=100; x++)
for (int y=0; y<=100; y++)
if (p*(8+x)*(8+y) == q*(48+4*x+4*y))
{
vector<vector<char> > v(8+x, vector<char>(8+y, '.'));
for (int i=0; i<8; i++) v[0][i] = ".##.##.."[i];
for (int i=0; i<8; i++) v[1][i] = "###.####"[i];
for (int i=0; i<8; i++) v[2][i] = "#.###.##"[i];
for (int i=0; i<8; i++) v[3][i] = "#######."[i];
for (int i=0; i<8; i++) v[4][i] = "##...##."[i];
for (int i=0; i<8; i++) v[5][i] = "#######."[i];
for (int i=0; i<8; i++) v[6][i] = "#.###.##"[i];
for (int i=0; i<8; i++) v[7][i] = "###.####"[i];
for (int i=8; i<8+y; i++)
{
v[1][i] = '#';
v[2][i] = '#';
v[6][i] = '#';
v[7][i] = '#';
}
for (int i=8; i<8+x; i++)
{
v[i][1] = '#';
v[i][2] = '#';
v[i][4] = '#';
v[i][5] = '#';
}
cout<<8+x<<" "<<8+y<<"\n";
for (int i=0; i<8+x; i++, cout<<"\n")
for (int j=0; j<8+y; j++)
cout<<v[i][j];
return true;
}
{
cout<<18<<" "<<6<<"\n";
cout<<".####.\n";
cout<<"###.##\n";
cout<<"#.####\n";
cout<<"####..\n";
cout<<"##.###\n";
cout<<".#####\n";
cout<<"###..#\n";
cout<<"#.####\n";
cout<<"#####.\n";
cout<<"##..##\n";
cout<<".#####\n";
cout<<"####.#\n";
cout<<"#..###\n";
cout<<"#####.\n";
cout<<"###.##\n";
cout<<"..####\n";
cout<<"####.#\n";
cout<<"##.###\n";
return true;
}
return false;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int p, q;
cin>>p>>q;
ask(p, q);
// for (int p=1; p<=10; p++)
// for (int q=p; q<=10; q++)
// {
// if (__gcd(p, q) == 1)
// {
//// cout<<p<<"/"<<q<<"\n";
// if (!ask(p, q))
// cout<<p<<"/"<<q<<" not found!!!!!!!!!!!!!!!!!!!\n";
// }
// }
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
2 3
output:
1 3 ##.
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
1 1
output:
-1 -1
result:
ok no solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
3 4
output:
4 4 .##. #### #..# ####
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
3 5
output:
10 4 .##. .##. .##. .##. .##. .##. .##. #### #..# ####
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
4 5
output:
5 5 ###.# #.### ####. ##.## .####
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
7 10
output:
5 4 .##. .##. #### #..# ####
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
5 7
output:
14 4 .##. .##. .##. #### #..# #### .##. #### #..# #### .##. #### #..# ####
result:
ok good solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
7 9
output:
18 6 .####. ###.## #.#### ####.. ##.### .##### ###..# #.#### #####. ##..## .##### ####.# #..### #####. ###.## ..#### ####.# ##.###
result:
ok good solution
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3600kb
input:
0 1
output:
18 6 .####. ###.## #.#### ####.. ##.### .##### ###..# #.#### #####. ##..## .##### ####.# #..### #####. ###.## ..#### ####.# ##.###
result:
wrong answer the total share of black squares must be 0/1, but your plan is 7/9