QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#658437 | #2789. Sorting | Pioneer# | 0 | 880ms | 4056kb | C++20 | 1.1kb | 2024-10-19 16:49:08 | 2024-10-19 16:49:09 |
Judging History
answer
#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
const int MAX=100000;
int n,m,x[MAX],y[MAX];
int s[MAX];
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
n=N,m=M;
for(int i=0;i<M;i++)x[i]=X[i],y[i]=Y[i];
for(int i=0;i<N;i++)s[i]=S[i];
vector<int> v(n),need(n);
vector<pair<int,int>> swaps;
for(int i=0;i<n;i++)v[i]=s[i],need[i]=i;
for(int i=0;i<m;i++){
swap(v[x[i]],v[y[i]]);
vector<int> tov=need;
for(int j=i+1;j<m;j++){
swap(tov[x[j]],tov[y[j]]);
}
bool ok=0;
for(int k=0;k<n;k++){
if(tov[k]!=v[k]){
for(int j=0;j<n;j++){
if(tov[j]==v[k]){
ok=1;
swaps.push_back({k,j});
swap(v[k],v[j]);
break;
}
}
if(ok)break;
}
}
tov=need;
for(int j=i+1;j<m;j++){
swap(tov[x[j]],tov[y[j]]);
}
for(int i=0;i<n;i++)cout<<tov[i]<<" "<<v[i]<<"\n";
cout<<"\n";
if(!ok)swaps.push_back({0,0});
}
// cout<<"\n";
assert(v==need);
for(int i=0;i<m;i++){
P[i]=swaps[i].first;
Q[i]=swaps[i].second;
}
return M;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3736kb
input:
1 0 1 0 0
output:
Unauthorized output
result:
wrong output format Expected integer, but "Unauthorized" found
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 3772kb
input:
1 0 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
Unauthorized output
result:
wrong output format Expected integer, but "Unauthorized" found
Subtask #3:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 3728kb
input:
2 0 1 60 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
output:
Unauthorized output
result:
wrong output format Expected integer, but "Unauthorized" found
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 880ms
memory: 4056kb
input:
1800 530 1775 466 953 230 1179 944 752 990 1316 275 1029 158 152 1673 1706 172 115 599 1661 131 699 1112 454 551 1059 291 495 28 67 773 480 839 462 1210 757 879 285 439 3 1429 820 26 1023 942 199 356 625 1705 1421 144 1529 716 7 1485 1027 1599 696 517 1353 456 1389 273 1363 1414 1177 718 41 777 1621...
output:
Unauthorized output
result:
wrong output format Expected integer, but "Unauthorized" found
Subtask #6:
score: 0
Skipped
Dependency #5:
0%