QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#238649 | #7637. Exactly Three Neighbors | tpc_icpc_n# | WA | 0ms | 3812kb | C++20 | 2.2kb | 2023-11-04 17:11:27 | 2023-11-04 17:11:30 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <forward_list>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#ifdef RUTHEN_LOCAL
#include <debug.hpp>
#else
#define show(x) true
#endif
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define rep(i,n) for (int i = 0; i< (n); i++)
#define all(x) x.begin(), x.end()
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int p,q; cin >> p >> q;
if(p==0 && q==0){
cout << "-1 -1" << endl;
return 0;
}
if(p==4 && q==5){
cout << "5 5" << endl;
cout << "####." << endl;
cout << "##.##" << endl;
cout << ".####" << endl;
cout << "###.#" << endl;
cout << "#.###" << endl;
return 0;
}
// if p/q <= 2/3
if(3*p <= 2*q){
string S(2*q,'.');
rep(i,p){
S[i*3] = '#';
S[i*3+1] = '#';
}
cout << "1 " << S.size() << endl;
cout << S << endl;
return 0;
}
else{
for(int n=3;n<=1000;n++){
for(int m=3;m<=1000;m++){
if(n+m-2<1000){
if(4*p == (2*p-q)*(m+n)){
vector<string> S(2,string(n+m-2,'.'));
rep(i,n) S[0][i]='#';
S[1][0] = '#';
rep(i,m-1) S[1][n+m-2-1-i]='#';
cout << "4 " << (n+m-2) << endl;
rep(i,4) cout << S[i/2] << endl;
return 0;
}
}
}
}
}
cout << "-1 -1" << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3812kb
input:
2 3
output:
1 6 ##.##.
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
1 1
output:
-1 -1
result:
ok no solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
3 4
output:
4 4 ###. ###. #.## #.##
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
3 5
output:
1 10 ##.##.##..
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
4 5
output:
5 5 ####. ##.## .#### ###.# #.###
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
7 10
output:
4 5 ###.. ###.. #.### #.###
result:
ok good solution
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
5 7
output:
-1 -1
result:
wrong answer you didn't find a solution but jury did