QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#516689#5459. Goose, goose, DUCK?no_RED_no_DEADTL 1280ms3620kbC++20709b2024-08-12 20:34:372024-08-12 20:34:37

Judging History

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

  • [2024-08-12 20:34:37]
  • 评测
  • 测评结果:TL
  • 用时:1280ms
  • 内存:3620kb
  • [2024-08-12 20:34:37]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;
using ll = long long;

const ll N = 1e6 + 1;
const ll M = 1e9 + 7;

ll n, k;
ll a[N];

void doTest(ll testID) {
    cin >> n >> k;
    for (int i = 1; i <= n; i ++) cin >> a[i];

    ll res = 0;
    for (int i = 1; i <= n; i ++)
        for (int j = i; j <= n; j ++) {
            map<ll, ll> m;
            for (int k = i; k <= j; k ++) m[a[k]] ++;
            bool ok = 1;
            for (auto [x, y]: m) ok &= (y != k);
            res += ok;
        }
    cout << res;
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int test = 1; 
    // cin >> test;
    for (int _ = 1; _ <= test; _ ++) doTest(test);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

6 2
1 2 2 1 3 3

output:

10

result:

ok 1 number(s): "10"

Test #2:

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

input:

6 1
1 2 3 4 5 6

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

100 10
142826 764475 142826 986320 764475 142826 142826 986320 764475 986320 764475 764475 764475 142826 142826 986320 764475 986320 764475 764475 142826 764475 142826 764475 986320 986320 764475 142826 764475 764475 142826 764475 764475 986320 142826 142826 142826 142826 764475 986320 986320 764475...

output:

4309

result:

ok 1 number(s): "4309"

Test #4:

score: 0
Accepted
time: 485ms
memory: 3496kb

input:

1000 100
144044 144044 606320 144044 144044 653289 606320 606320 606320 144044 653289 606320 144044 606320 144044 653289 606320 653289 144044 144044 606320 606320 606320 144044 606320 653289 653289 144044 606320 606320 606320 606320 606320 606320 606320 606320 653289 606320 653289 606320 653289 6532...

output:

494331

result:

ok 1 number(s): "494331"

Test #5:

score: 0
Accepted
time: 1074ms
memory: 3540kb

input:

1000 2
37158 712133 695735 352502 37158 111876 979836 322207 850 170255 712133 37158 68113 170255 269273 322207 644692 127744 575843 269273 352502 68113 166126 413274 111876 575843 704107 695735 37158 604776 127744 269273 166126 704107 850 111876 352502 979836 850 850 712133 850 979836 575843 704107...

output:

382010

result:

ok 1 number(s): "382010"

Test #6:

score: 0
Accepted
time: 1280ms
memory: 3548kb

input:

1000 1
439144 11249 309118 842057 842057 938195 823723 842057 589439 914850 938195 455713 91595 938195 553566 761181 553566 70966 455713 439144 704849 11249 11249 236580 320993 933831 872377 589439 435476 558991 914850 690853 482410 690853 715546 155003 435476 155003 435476 435476 842057 236580 7096...

output:

341042

result:

ok 1 number(s): "341042"

Test #7:

score: -100
Time Limit Exceeded

input:

1000 1
675227 756097 647871 465683 473815 162625 396802 61313 758469 968915 283015 326083 86904 672294 145904 621859 346020 237440 669779 282692 626616 722910 999031 141389 440533 971280 807058 346648 405103 669779 463968 214284 50833 661085 826455 991362 984243 704592 426668 998421 949882 147122 72...

output:


result: