QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#660344 | #7011. Rikka with Sorting Networks | welikestudying | WA | 57ms | 3644kb | C++14 | 623b | 2024-10-20 10:33:50 | 2024-10-20 10:33:50 |
Judging History
answer
#include<bits/stdc++.h>
#define up(a,b,c)for(int a=b;a<=c;++a)
#define dn(a,b,c)for(int a=b;a>=c;--a)
using namespace std;
int T,n,k,p,u[11],v[11],a[55],ans;
void dfs(int e)
{
if(!e)
++ans;
else if(a[u[e]]<a[v[e]])
dfs(e-1),swap(a[u[e]],a[v[e]]),
dfs(e-1),swap(a[u[e]],a[v[e]]);
}
int main()
{
cin>>T;
while(T--)
{
cin>>n>>k>>p,ans=0;
up(i,1,k)cin>>u[i]>>v[i];
iota(a,a+n+1,0);
dfs(k);
up(i,1,n-1)
{
iota(a,a+n+1,0);
up(j,i+1,n)
swap(a[j-1],a[j]),dfs(k);
iota(a,a+n+1,0);
dn(j,i,2)
swap(a[j-1],a[j]),dfs(k);
}
cout<<ans<<'\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
4 4 0 998244353 4 1 998244353 1 2 4 3 998244353 1 2 2 3 1 2 4 6 998244353 1 2 2 3 1 2 3 4 2 3 1 2
output:
10 14 24 24
result:
ok 4 lines
Test #2:
score: -100
Wrong Answer
time: 57ms
memory: 3632kb
input:
100 14 0 332974091 7 0 860384617 38 0 721801273 20 0 905563207 15 0 665595113 19 0 315971339 37 10 381449743 20 25 20 25 20 25 20 25 20 25 20 25 20 25 20 25 20 25 20 25 33 7 891399043 7 17 6 16 25 32 25 31 16 25 25 32 17 30 35 0 134186387 43 4 344440849 14 26 26 29 14 26 14 29 44 3 520502371 5 8 5 8...
output:
170 37 1370 362 197 325 2530 72688 1157 10164 3618 12288 2490 2542 785 5508 1428 7080 642 31620 2534 257184 4210 8862 53152 842 12292 7960 1532 362 956 1990 4178 27752 9648 10314 1765 9444 31768 4332 3468 9316 219232 1778 22200 3992 52588 79312 8708 8276 1346 36136 3480 6922 3490 850 2210 1890 328 1...
result:
wrong answer 7th lines differ - expected: '2528', found: '2530'