QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#229945#7637. Exactly Three Neighborsucup-team987#AC ✓0ms3824kbC++233.7kb2023-10-28 17:17:482023-10-28 17:17:49

Judging History

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

  • [2023-10-28 17:17:49]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3824kb
  • [2023-10-28 17:17:48]
  • 提交

answer

#if __INCLUDE_LEVEL__ == 0

#include __BASE_FILE__

namespace {

void solve() {
  int p, q;
  scan(p, q);

  if (q * 4 < p * 5) {
    print(-1, -1);
  }

  if (p * 3 <= q * 2) {
    string s(q * 2, '.');
    for (int i : rep(p)) {
      s[i * 3] = '#';
      s[i * 3 + 1] = '#';
    }
    print(1, q * 2);
    print(s);
  }

  if (p == 3 && q == 4) {
    print(8, 8);
    print("..######");
    print("###..###");
    print("######..");
    print("#..#####");
    print("####..##");
    print(".######.");
    print("##..####");
    print("#####..#");
  }

  if (p == 4 && q == 5) {
    print(5, 5);
    print(".####");
    print("##.##");
    print("####.");
    print("#.###");
    print("###.#");
  }

  if (p == 5 && q == 7) {
    print(14, 14);
    int i = 0;
    do {
      string s(14, '#');
      for (int j : rep(i, i + 4)) {
        s[j % 14] = '.';
      }
      print(s);
      i += 5;
      i %= 14;
    } while (i);
  }

  if (p == 7 && q == 9) {
    print(18, 6);
    print("..####");
    print("####.#");
    print("##.###");
    print(".####.");
    print("###.##");
    print("#.####");
    print("####..");
    print("##.###");
    print(".#####");
    print("###..#");
    print("#.####");
    print("#####.");
    print("##..##");
    print(".#####");
    print("####.#");
    print("#..###");
    print("#####.");
    print("###.##");
  }

  if (p == 7 && q == 10) {
    print(20, 20);
    int i = 0;
    do {
      string s(20, '#');
      for (int j : rep(i, i + 6)) {
        s[j % 20] = '.';
      }
      print(s);
      i += 7;
      i %= 20;
    } while (i);
  }
}

}  // namespace

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  solve();
}

#else  // __INCLUDE_LEVEL__

#include <bits/stdc++.h>

using namespace std;

namespace std {

template <class T1, class T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
  return is >> p.first >> p.second;
}

template <class... Ts>
istream& operator>>(istream& is, tuple<Ts...>& t) {
  return apply([&is](auto&... xs) -> istream& { return (is >> ... >> xs); }, t);
}

template <class R, enable_if_t<!is_convertible_v<R, string>>* = nullptr>
auto operator>>(istream& is, R&& r) -> decltype(is >> *begin(r)) {
  for (auto&& e : r) {
    is >> e;
  }
  return is;
}

template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << p.first << ' ' << p.second;
}

template <class... Ts>
ostream& operator<<(ostream& os, const tuple<Ts...>& t) {
  auto f = [&os](const auto&... xs) -> ostream& {
    [[maybe_unused]] auto sep = "";
    ((os << exchange(sep, " ") << xs), ...);
    return os;
  };
  return apply(f, t);
}

template <class R, enable_if_t<!is_convertible_v<R, string_view>>* = nullptr>
auto operator<<(ostream& os, R&& r) -> decltype(os << *begin(r)) {
  auto sep = "";
  for (auto&& e : r) {
    os << exchange(sep, " ") << e;
  }
  return os;
}

}  // namespace std

template <class... Ts>
void scan(Ts&&... xs) {
  (cin >> ... >> xs);
}

template <class... Ts>
void print(Ts&&... xs) {
  cout << tie(xs...) << '\n';
}

inline auto rep(int l, int r) { return views::iota(min(l, r), r); }
inline auto rep(int n) { return rep(0, n); }
inline auto rep1(int l, int r) { return rep(l, r + 1); }
inline auto rep1(int n) { return rep(1, n + 1); }
inline auto per(int l, int r) { return rep(l, r) | views::reverse; }
inline auto per(int n) { return per(0, n); }
inline auto per1(int l, int r) { return per(l, r + 1); }
inline auto per1(int n) { return per(1, n + 1); }

inline auto len = ranges::ssize;

#endif  // __INCLUDE_LEVEL__

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

2 3

output:

1 6
##.##.

result:

ok good solution

Test #2:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

1 1

output:

-1 -1

result:

ok no solution

Test #3:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

3 4

output:

8 8
..######
###..###
######..
#..#####
####..##
.######.
##..####
#####..#

result:

ok good solution

Test #4:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

3 5

output:

1 10
##.##.##..

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: 3512kb

input:

7 10

output:

20 20
......##############
#######......#######
##############......
#......#############
########......######
.##############.....
##......############
#########......#####
..##############....
###......###########
##########......####
...##############...
####......##########
###########......###
...

result:

ok good solution

Test #7:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

5 7

output:

14 14
....##########
#####....#####
##########....
#....#########
######....####
.##########...
##....########
#######....###
..##########..
###....#######
########....##
...##########.
####....######
#########....#

result:

ok good solution

Test #8:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

7 9

output:

18 6
..####
####.#
##.###
.####.
###.##
#.####
####..
##.###
.#####
###..#
#.####
#####.
##..##
.#####
####.#
#..###
#####.
###.##

result:

ok good solution

Test #9:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

0 1

output:

1 2
..

result:

ok good solution

Test #10:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

1 2

output:

1 4
##..

result:

ok good solution

Test #11:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

1 3

output:

1 6
##....

result:

ok good solution

Test #12:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

1 4

output:

1 8
##......

result:

ok good solution

Test #13:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

1 5

output:

1 10
##........

result:

ok good solution

Test #14:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1 6

output:

1 12
##..........

result:

ok good solution

Test #15:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

1 7

output:

1 14
##............

result:

ok good solution

Test #16:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

1 8

output:

1 16
##..............

result:

ok good solution

Test #17:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

1 9

output:

1 18
##................

result:

ok good solution

Test #18:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

1 10

output:

1 20
##..................

result:

ok good solution

Test #19:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 5

output:

1 10
##.##.....

result:

ok good solution

Test #20:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2 7

output:

1 14
##.##.........

result:

ok good solution

Test #21:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

2 9

output:

1 18
##.##.............

result:

ok good solution

Test #22:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

3 7

output:

1 14
##.##.##......

result:

ok good solution

Test #23:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

3 8

output:

1 16
##.##.##........

result:

ok good solution

Test #24:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

3 10

output:

1 20
##.##.##............

result:

ok good solution

Test #25:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

4 7

output:

1 14
##.##.##.##...

result:

ok good solution

Test #26:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

4 9

output:

1 18
##.##.##.##.......

result:

ok good solution

Test #27:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5 6

output:

-1 -1

result:

ok no solution

Test #28:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

5 8

output:

1 16
##.##.##.##.##..

result:

ok good solution

Test #29:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

5 9

output:

1 18
##.##.##.##.##....

result:

ok good solution

Test #30:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

6 7

output:

-1 -1

result:

ok no solution

Test #31:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

7 8

output:

-1 -1

result:

ok no solution

Test #32:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

8 9

output:

-1 -1

result:

ok no solution

Test #33:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

9 10

output:

-1 -1

result:

ok no solution

Extra Test:

score: 0
Extra Test Passed