QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#238649#7637. Exactly Three Neighborstpc_icpc_n#WA 0ms3812kbC++202.2kb2023-11-04 17:11:272023-11-04 17:11:30

Judging History

你现在查看的是最新测评结果

  • [2023-11-04 17:11:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3812kb
  • [2023-11-04 17:11:27]
  • 提交

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