QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#143661 | #6131. Tournament | PhantomThreshold# | WA | 2ms | 3472kb | C++20 | 874b | 2023-08-21 14:27:48 | 2023-08-21 14:27:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
int T;
cin>>T;
while(T--)
{
int n,m;
cin>>n>>m;
if(n%2==1)
{
cout<<"Impossible\n";
}
else if(n%4==2)
{
if(m>1)cout<<"Impossible\n";
else
{
for(int i=1;i<=n;i++)
{
if(i%2==1)cout<<i+1<<" \n"[i==n];
else cout<<i-1<<" \n"[i==n];
}
}
}
else
{
if(m>3)cout<<"Impossible\n";
else
{
for(int i=0;i<n;i+=4)
{
cout<<i+2<<' '<<i+1<<' '<<i+4<<' '<<i+3<<" \n"[i==n-4];
}
if(m>=2)
{
for(int i=0;i<n;i+=4)
{
cout<<i+3<<' '<<i+4<<' '<<i+1<<' '<<i+2<<" \n"[i==n-4];
}
}
if(m>=3)
{
for(int i=0;i<n;i+=4)
{
cout<<i+4<<' '<<i+3<<' '<<i+2<<' '<<i+1<<" \n"[i==n-4];
}
}
}
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3472kb
input:
2 3 1 4 3
output:
Impossible 2 1 4 3 3 4 1 2 4 3 2 1
result:
ok 4 lines
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3432kb
input:
100 1 4 2 1 2 2 2 3 3 6 4 2 4 3 4 4 4 5 5 4 6 1 6 2 6 4 7 1 8 3 8 7 8 8 8 14 9 4 10 1 10 2 10 3 12 2 12 3 12 4 12 8 13 2 14 1 14 2 14 4 15 4 16 9 16 15 16 16 16 28 17 6 18 1 18 2 18 4 19 5 20 1 20 3 20 4 20 6 21 1 22 1 22 2 22 3 23 4 24 5 24 7 24 8 24 15 25 3 26 1 26 2 26 3 27 5 28 1 28 3 28 4 28 6 ...
output:
Impossible 2 1 Impossible Impossible Impossible 2 1 4 3 3 4 1 2 2 1 4 3 3 4 1 2 4 3 2 1 Impossible Impossible Impossible 2 1 4 3 6 5 Impossible Impossible Impossible 2 1 4 3 6 5 8 7 3 4 1 2 7 8 5 6 4 3 2 1 8 7 6 5 Impossible Impossible Impossible Impossible 2 1 4 3 6 5 8 7 10 9 Impossible Impossible...
result:
wrong answer 21st lines differ - expected: '2 1 4 3 6 5 8 7', found: 'Impossible'