QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#260234#6677. Puzzle: Sashiganelearn_cuteWA 0ms3380kbC++141.3kb2023-11-21 22:41:222023-11-21 22:41:23

Judging History

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

  • [2023-11-21 22:41:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3380kb
  • [2023-11-21 22:41:22]
  • 提交

answer

#include<bits/stdc++.h>

#define endl "\n"
#define pb push_back

using namespace std;
using LL = long long;
using PII = pair<int, int>;

const int N = 1e5+10;

int n, X, Y;
struct Ans {
    int x1, y1, x2, y2;
};
vector<Ans> ans;

void dfs(int x1, int y1, int x2, int y2) {
    int d = x2 - x1;
    if (!d) return;
    if (x1 != X && y1 != Y) {
        dfs(x1 + 1, y1 + 1, x2, y2);
        ans.pb({x1, y1, d, d});
    } 
    else if (x1 != X && y2 != Y) {
        dfs(x1 + 1, y1, x2, y2 - 1);
        ans.pb({x1, y2, d, -d});
    }
    else if (x2 != X && y1 != Y) {
        dfs(x1, y1 + 1, x2 - 1, y2);
        ans.pb({x2, y1, -d, d});
    }
    else if (x2 != X && y2 != Y) {
        dfs(x1, y1, x2 - 1, y2 - 1);
        ans.pb({x2, y2, -d, -d});
    }
}

int main() {

#ifdef ONLINE_JUDGE
#else
    freopen("D:\\VSCODE\\CPP\\codeforces\\test\\in.txt","r",stdin);
    freopen("D:\\VSCODE\\CPP\\codeforces\\test\\out.txt","w",stdout);
#endif

    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    cin >> n >> X >> Y;
    cout << "Yes\n";
    dfs(1, 1, n, n);
    for (auto [r, c, h, w] : ans) {
        cout << r << ' ';
        cout << c << ' ';
        cout << h << ' ';
        cout << w << '\n';
    }

    return 0;
}

详细

Test #1:

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

input:

5 3 4

output:

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

result:

wrong answer Integer parameter [name=c] equals to -1, violates the range [1, 5] (test case 1)