QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#381429#6677. Puzzle: SashiganeSSHL#WA 0ms3660kbC++141.6kb2024-04-07 17:38:162024-04-07 17:38:16

Judging History

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

  • [2024-04-07 17:38:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3660kb
  • [2024-04-07 17:38:16]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
void solve()
{
    int n,a,b;
    cin>>n>>a>>b;
    cout<<"Yes\n";
    vector<int> ans;
    int d=min(a-1,n-b);
    int r=a-d,w=b+d;
    int h=w-r;
    bool f=1;
    for(;r<=n&&w>=1;r++,w--)
    {
        if(a==r&&b==w)
        {
            f=1-f;
            h=1;
            continue;
        }
        if(f)
        {
            ans.push_back(r);
        ans.push_back(w);
        ans.push_back(h);
        ans.push_back(-h);
        h--;
        }else{
            
            ans.push_back(r);
        ans.push_back(w);
        ans.push_back(-h);
        ans.push_back(h);
        h++;
        }
    }
    if(!(r==n+1&&w==0))
    {
        if(r==n+1)
        {
            r=a-d-1;
            f=1;
        }
        if(w==0)
        {
            w=b+d+1;
            f=0;
        }
        h=abs(b-a)+1+2*d;
    }
    if(f)
    {
        for(;r>0&&w>0;r--,w--)
        {
            ans.push_back(r);
        ans.push_back(w);
        ans.push_back(h);
        ans.push_back(h);
        h++;
        }
    }else{
        for(;r<=n&&w<=n;r++,w++)
        {
            ans.push_back(r);
        ans.push_back(w);
        ans.push_back(-h);
        ans.push_back(-h);
        h++;
        }
    }
    cout<<ans.size()/4<<'\n';
    for(int i=0;i<ans.size();i+=4)
    {
        cout<<ans[i]<<' '<<ans[i+1]<<' '<<ans[i+2]<<' '<<ans[i+3]<<'\n';
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t=1;
    // cin>>t;
    while(t--)
    solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 3 4

output:

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

result:

ok Correct. (1 test case)

Test #2:

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

input:

1 1 1

output:

Yes
0

result:

ok Correct. (1 test case)

Test #3:

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

input:

3 2 3

output:

Yes
2
3 2 -1 1
1 1 2 2

result:

ok Correct. (1 test case)

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3660kb

input:

10 10 5

output:

Yes
9
5 10 5 -5
6 9 4 -4
7 8 3 -3
8 7 2 -2
9 6 1 -1
4 4 16 16
3 3 17 17
2 2 18 18
1 1 19 19

result:

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