QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#248596 | #2784. Aliens | Camillus# | 0 | 1ms | 4096kb | C++20 | 792b | 2023-11-11 20:16:25 | 2024-07-04 02:24:42 |
answer
#include "bits/stdc++.h"
#include "aliens.h"
using ll = long long;
using namespace std;
ll take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
set<pair<int, int>> Q;
for (int i = 0; i < n; i++) {
Q.emplace(min(r[i], c[i]), max(r[i], c[i]));
}
vector<pair<int, int>> A(Q.begin(), Q.end());
m = Q.size();
auto square = [](auto P) -> ll {
ll x = P.second - P.first + 1;
return max(0ll, x * x);
};
auto merge = [](auto P1, auto P2) -> pair<int, int> {
return make_pair(max(P1.first, P2.first), min(P1.second, P2.second));
};
ll cur = square(A[0]);
for (int i = 1; i < m; i++) {
cur += square(A[i]) - square(merge(A[i], A[i - 1]));
}
return cur;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 4
Accepted
time: 1ms
memory: 4084kb
input:
2 6 2 1 4 4 1
output:
098d134608c94f7413faac591054ee35 16
result:
ok Correct answer: answer = 16
Test #2:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
1 2 1 0 1
output:
098d134608c94f7413faac591054ee35 4
result:
ok Correct answer: answer = 4
Test #3:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
2 2 2 0 0 1 0
output:
098d134608c94f7413faac591054ee35 4
result:
ok Correct answer: answer = 4
Test #4:
score: 0
Accepted
time: 0ms
memory: 4052kb
input:
2 3 2 0 1 1 1
output:
098d134608c94f7413faac591054ee35 4
result:
ok Correct answer: answer = 4
Test #5:
score: 0
Accepted
time: 0ms
memory: 4096kb
input:
4 4 4 1 3 0 1 2 1 2 2
output:
098d134608c94f7413faac591054ee35 12
result:
ok Correct answer: answer = 12
Test #6:
score: -4
Wrong Answer
time: 0ms
memory: 3860kb
input:
5 8 5 0 5 2 6 7 4 4 5 2 6
output:
098d134608c94f7413faac591054ee35 57
result:
wrong answer Wrong answer: output = 57, expected = 52
Subtask #2:
score: 0
Wrong Answer
Test #23:
score: 0
Wrong Answer
time: 0ms
memory: 3740kb
input:
2 2 1 0 0 1 1
output:
098d134608c94f7413faac591054ee35 2
result:
wrong answer Wrong answer: output = 2, expected = 4
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%