QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#126786#2784. Alienssomethingnew#0 4ms4088kbC++202.0kb2023-07-18 23:49:352024-07-04 00:45:22

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 00:45:22]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:4088kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-18 23:49:35]
  • 提交

answer

//  ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙
//  ➡ @roadfromroi ⬅
//  ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖
#include <iostream>
#include "vector"
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#include "aliens.h"
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
ll sq(ll a) {
    return a * a;
}
pair<ll, int> reba(int n, vector<pair<int, int>> opp, ll cc) {
    vector<int> cnt(n + 1);
    vector<ll> dp(n + 1, 1e18);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            ll vl = dp[i] + sq(opp[i].first - opp[j-1].second - 1) + cc;
            if (dp[j] > vl) {
                dp[j] = vl;
                cnt[j] = cnt[i] + 1;
            }
        }
    }
    return {dp[n], cnt[n]};
}
ll take_photos(int n, int m, int k, vector<int> re, vector<int> c) {
    vector<pair<int, int>> sgg(n);
    for (int i = 0; i < n; ++i) {
        sgg[i] = {min(re[i], c[i]), max(re[i], c[i])};
    }
    sort(all(sgg));
    vector<pair<int, int>> bb;
    for (auto [l, r] : sgg) {
        while (!bb.empty() and l == bb.back().first)
            bb.pop_back();
        if (bb.empty() or bb.back().second < r) {
            bb.push_back({l, r});
        }
    }
    sgg = bb;
    n = sgg.size();
    ll l = 0, r = (ll)1e14;
    while (l + 1 < r) {
        ll m = l + r >> 1ll;
        if (reba(n, sgg, m).second >= k) {
            l = m;
        } else {
            r = m;
        }
    }
    //cout << l << endl;
    pair<ll, int> val = reba(n, sgg, l);
    return val.first - l * val.second + l * (k-val.second);
}/*
int main() {
    int n, m, k;
    assert(3 == scanf("%d %d %d", &n, &m, &k));
    std::vector<int> r(n), c(n);
    for (int i = 0; i < n; i++) {
        assert(2 == scanf("%d %d", &r[i], &c[i]));
    }
    long long ans = take_photos(n, m, k, r, c);


    printf("%lld\n", ans);
    return 0;
}
*/

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 4
Accepted
time: 0ms
memory: 3780kb

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: 3792kb

input:

1 2 1
0 1

output:

098d134608c94f7413faac591054ee35
4

result:

ok Correct answer: answer = 4

Test #3:

score: 0
Accepted
time: 0ms
memory: 3868kb

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: 3808kb

input:

2 3 2
0 1
1 1

output:

098d134608c94f7413faac591054ee35
4

result:

ok Correct answer: answer = 4

Test #5:

score: -4
Wrong Answer
time: 0ms
memory: 4048kb

input:

4 4 4
1 3
0 1
2 1
2 2

output:

098d134608c94f7413faac591054ee35
13

result:

wrong answer Wrong answer: output = 13, expected = 12

Subtask #2:

score: 0
Wrong Answer

Test #23:

score: 12
Accepted
time: 0ms
memory: 4072kb

input:

2 2 1
0 0
1 1

output:

098d134608c94f7413faac591054ee35
4

result:

ok Correct answer: answer = 4

Test #24:

score: 0
Accepted
time: 0ms
memory: 4044kb

input:

4 3 2
0 0
0 0
0 0
0 0

output:

098d134608c94f7413faac591054ee35
1

result:

ok Correct answer: answer = 1

Test #25:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

5 5 2
2 2
3 3
4 4
3 3
3 3

output:

098d134608c94f7413faac591054ee35
5

result:

ok Correct answer: answer = 5

Test #26:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

10 20 3
3 3
15 15
10 10
18 18
4 4
7 7
15 15
2 2
10 10
7 7

output:

098d134608c94f7413faac591054ee35
41

result:

ok Correct answer: answer = 41

Test #27:

score: 0
Accepted
time: 0ms
memory: 4088kb

input:

20 1000 5
737 737
714 714
662 662
163 163
683 683
615 615
23 23
246 246
724 724
90 90
802 802
557 557
146 146
429 429
816 816
164 164
638 638
568 568
957 957
904 904

output:

098d134608c94f7413faac591054ee35
71923

result:

ok Correct answer: answer = 71923

Test #28:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

200 1000 10
69 69
277 277
350 350
753 753
741 741
849 849
993 993
95 95
928 928
789 789
333 333
795 795
493 493
253 253
661 661
780 780
17 17
394 394
487 487
719 719
426 426
297 297
885 885
323 323
981 981
916 916
0 0
997 997
757 757
374 374
467 467
787 787
297 297
216 216
599 599
62 62
936 936
777 ...

output:

098d134608c94f7413faac591054ee35
77137

result:

ok Correct answer: answer = 77137

Test #29:

score: -12
Wrong Answer
time: 4ms
memory: 3820kb

input:

500 1000 250
599 599
14 14
176 176
963 963
93 93
257 257
403 403
741 741
854 854
862 862
778 778
489 489
711 711
623 623
163 163
750 750
649 649
441 441
245 245
311 311
429 429
756 756
572 572
766 766
837 837
137 137
719 719
244 244
519 519
287 287
251 251
818 818
789 789
305 305
400 400
262 262
359...

output:

098d134608c94f7413faac591054ee35
699

result:

wrong answer Wrong answer: output = 699, expected = 764

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%