QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#419130#7637. Exactly Three Neighbors1e11#AC ✓1ms3888kbC++202.0kb2024-05-23 18:05:062024-05-23 18:05:08

Judging History

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

  • [2024-05-23 18:05:08]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3888kb
  • [2024-05-23 18:05:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using ll = long long;
#define SZ(v) (ll)((v).size())
#define pb emplace_back
#define AI(i) begin(i), end(i)
#define X first
#define Y second
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);

  int p, q;
  cin >> p >> q;

  // p / q <= 2 / 3
  if (p * 3 <= q * 2) {
	  string pat;
	  for (int i = 0; i < p; i++)
		  pat += "##.";
	  for (int i = 0; i < q * 2 - 3 * p; i++)
		  pat += ".";
	  cout << 1 << ' ' << pat.size() << '\n';
	  cout << pat << '\n';
	  return 0;
  }
  else if (p * 5 > q * 4){
  	  cout << "-1 -1\n";
  }
  else if (p * 5 == q * 4){
	  cout << "5 5\n";
	  cout << ".####\n";
	  cout << "###.#\n";
	  cout << "#.###\n";
	  cout << "####.\n";
	  cout << "##.##\n";
	  return 0;
  }
  else if (p * 4 == q * 3){
  	  cout << "4 4\n";
	  cout << ".###\n";
	  cout << ".###\n";
	  cout << "##.#\n";
	  cout << "##.#\n";
  }
  else if (p * 10 == q * 7){
  	  cout << "4 5\n";
	  cout << ".####\n";
	  cout << ".####\n";
	  cout << "##..#\n";
	  cout << "##..#\n";
  }
  else if (p * 7 == q * 5){
	  cout << "6 7\n";
	  cout << "..##.##\n";
	  cout << "..##.##\n";
	  cout << "####.##\n";
	  cout << "##.###.\n";
	  cout << "##.###.\n";
	  cout << "####.##\n";
  }
  else if (p * 9 == q * 7) {
	  cout << "18 6\n";
	  vector<string> a(3);
	  a[0] = "#####.";
	  a[1] = "###.##";
	  a[2] = "..####";
	  for (int i = 0; i < 18; i++) {
		  auto s = a[i % 3];
		  rotate(s.begin(), s.begin() + i / 3, s.end());
		  cout << s << '\n';
	  }
  }
  else {
	  cout << "-1 -1\n"; 
  }
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3592kb

input:

2 3

output:

1 6
##.##.

result:

ok good solution

Test #2:

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

input:

1 1

output:

-1 -1

result:

ok no solution

Test #3:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

3 4

output:

4 4
.###
.###
##.#
##.#

result:

ok good solution

Test #4:

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

input:

3 5

output:

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

result:

ok good solution

Test #5:

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

input:

4 5

output:

5 5
.####
###.#
#.###
####.
##.##

result:

ok good solution

Test #6:

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

input:

7 10

output:

4 5
.####
.####
##..#
##..#

result:

ok good solution

Test #7:

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

input:

5 7

output:

6 7
..##.##
..##.##
####.##
##.###.
##.###.
####.##

result:

ok good solution

Test #8:

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

input:

7 9

output:

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

result:

ok good solution

Test #9:

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

input:

0 1

output:

1 2
..

result:

ok good solution

Test #10:

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

input:

1 2

output:

1 4
##..

result:

ok good solution

Test #11:

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

input:

1 3

output:

1 6
##....

result:

ok good solution

Test #12:

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

input:

1 4

output:

1 8
##......

result:

ok good solution

Test #13:

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

input:

1 5

output:

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

result:

ok good solution

Test #14:

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

input:

1 6

output:

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

result:

ok good solution

Test #15:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

1 7

output:

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

result:

ok good solution

Test #16:

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

input:

1 8

output:

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

result:

ok good solution

Test #17:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

1 9

output:

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

result:

ok good solution

Test #18:

score: 0
Accepted
time: 1ms
memory: 3876kb

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

input:

2 7

output:

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

result:

ok good solution

Test #21:

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

input:

2 9

output:

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

result:

ok good solution

Test #22:

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

input:

3 7

output:

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

result:

ok good solution

Test #23:

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

input:

3 8

output:

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

result:

ok good solution

Test #24:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

3 10

output:

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

result:

ok good solution

Test #25:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

4 7

output:

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

result:

ok good solution

Test #26:

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

input:

4 9

output:

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

result:

ok good solution

Test #27:

score: 0
Accepted
time: 1ms
memory: 3872kb

input:

5 6

output:

-1 -1

result:

ok no solution

Test #28:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

5 8

output:

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

result:

ok good solution

Test #29:

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

input:

5 9

output:

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

result:

ok good solution

Test #30:

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

input:

6 7

output:

-1 -1

result:

ok no solution

Test #31:

score: 0
Accepted
time: 1ms
memory: 3872kb

input:

7 8

output:

-1 -1

result:

ok no solution

Test #32:

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

input:

8 9

output:

-1 -1

result:

ok no solution

Test #33:

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

input:

9 10

output:

-1 -1

result:

ok no solution

Extra Test:

score: 0
Extra Test Passed