QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#134258 | #2670. Arranging shoes | valerikk# | 10 | 2ms | 9108kb | C++17 | 651b | 2023-08-03 15:57:20 | 2024-07-04 01:12:20 |
Judging History
answer
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
typedef long long ll;
const int N = 1e5 + 7;
int n;
int s[2 * N];
vector<int> ls[N], rs[N];
}
long long count_swaps(vector<int> grds) {
n = grds.size() / 2;
for (int i = 0; i < 2 * n; ++i) {
s[i] = grds[i];
}
for (int i = 0; i < 2 * n; ++i) {
if (s[i] < 0) {
ls[-s[i]].push_back(i);
} else {
rs[s[i]].push_back(i);
}
}
ll ans = 0;
for (int x = 1; x <= n; ++x) {
for (int i = 0; i < (int)ls[x].size(); ++i) {
int l = ls[x][i];
int r = rs[x][i];
if (l > r) {
ans += 1;
swap(l, r);
}
ans += r - l - 1;
}
}
return ans;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 8452kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 1 -1 1
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 0
result:
ok 3 lines
Test #2:
score: 10
Accepted
time: 2ms
memory: 8396kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 1 1 -1
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 1
result:
ok 3 lines
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #3:
score: 20
Accepted
time: 2ms
memory: 8416kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 2 -1 -2 2 1
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 2
result:
ok 3 lines
Test #4:
score: 20
Accepted
time: 0ms
memory: 8688kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 2 -2 1 -1 2
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 3
result:
ok 3 lines
Test #5:
score: 20
Accepted
time: 0ms
memory: 9108kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 2 -2 2 -1 1
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 0
result:
ok 3 lines
Test #6:
score: 20
Accepted
time: 2ms
memory: 8628kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 2 -1 -2 2 1
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 2
result:
ok 3 lines
Test #7:
score: 0
Wrong Answer
time: 2ms
memory: 8516kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 2 -1 2 1 -2
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 3
result:
wrong answer 3rd lines differ - expected: '2', found: '3'
Subtask #3:
score: 0
Wrong Answer
Test #37:
score: 0
Wrong Answer
time: 2ms
memory: 8660kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 2 -2 -2 2 2
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 2
result:
wrong answer 3rd lines differ - expected: '1', found: '2'
Subtask #4:
score: 0
Wrong Answer
Test #74:
score: 15
Accepted
time: 2ms
memory: 8440kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 1 -1 1
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 0
result:
ok 3 lines
Test #75:
score: 0
Wrong Answer
time: 2ms
memory: 8416kb
input:
08f55b3f-c300-4051-a472-59ca2a776178 2 -1 -2 1 2
output:
9ce55564-5404-428a-8d2e-0d809c85101e OK 2
result:
wrong answer 3rd lines differ - expected: '1', found: '2'
Subtask #5:
score: 0
Skipped
Dependency #2:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%