QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#381429 | #6677. Puzzle: Sashigane | SSHL# | WA | 0ms | 3660kb | C++14 | 1.6kb | 2024-04-07 17:38:16 | 2024-04-07 17:38:16 |
Judging History
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;
}
詳細信息
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)