QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#712518#6677. Puzzle: Sashiganewsyear#WA 0ms3592kbC++201.5kb2024-11-05 15:59:252024-11-05 15:59:26

Judging History

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

  • [2024-11-05 15:59:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-11-05 15:59:25]
  • 提交

answer

#include <bits/stdc++.h>

#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

vector<tuple<int, int, int, int>> ans;
int n, x, y;

int main() {
  cin.tie(nullptr) -> ios::sync_with_stdio(false);
  cin >> n >> x >> y;
  int xl = x, xr = x, yl = y, yr = y;
  while (xl > 1 || xr < n|| yl > 1 || yr < n) {
    // cerr << xl << " " << xr << " " << yl << " " << yr << endl;
    if (xl - 1 > n - xr && yl - 1 > n - yr) {
      ans.emplace_back(xl - 1, yl - 1, xr - xl + 1, yr - yl + 1);
      xl--, yl--;
    } else if (xl - 1 > n - xr && yl - 1 <= n - yr) {
      ans.emplace_back(xl - 1, yr + 1, xr - xl + 1, -(yr - yl + 1));
      xl--, yr++;
    } else if (xl - 1 <= n - xr && yl - 1 > n - yr) {
      ans.emplace_back(xr + 1, yl - 1, -(xr - xl + 1), yr - yl + 1);
      xr++, yl--;
    } else if (xl - 1 <= n - xr && yl - 1 <= n - yr) {
      ans.emplace_back(xr + 1, yl + 1, -(xr - xl + 1), -(yr - yl + 1));
      xr++, yr++;
    }
  }
  cout << "Yes\n";
  cout << SZ(ans) << '\n';
  for (auto [a, b, c, d] : ans) cout << a << " " << b << " " << c << " " << d << '\n';
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3592kb

input:

5 3 4

output:

Yes
4
4 3 -1 1
2 2 2 2
5 3 -3 -3
1 1 4 4

result:

wrong answer L shape #3 out of bounds. (test case 1)