QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#421337#6828. Heirloom PaintingLilyWhiteAC ✓64ms13076kbC++203.1kb2024-05-25 16:42:492024-05-25 16:42:49

Judging History

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

  • [2024-05-25 16:42:49]
  • 评测
  • 测评结果:AC
  • 用时:64ms
  • 内存:13076kb
  • [2024-05-25 16:42:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
#define repn(i, n) for (int i = 1; i <= (int)n; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repr(i, m, n) for (int i = (int)m; i <= (int)n; i++)
#define repd(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#ifdef LILYWHITE
    #define eprintf(...) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#else
    #define eprintf(...) ;
#endif
const int __attribute__((unused)) INF = 0x3f3f3f3f;
template <typename T> inline T rd(T &x) {
    x = 0;
    T neg = 1;
    char c = 0;
    while (c < '0' || c > '9') {
        if (c == '-')
            neg = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - 48;
        c = getchar();
    }
    x *= neg;
    return x;
}
template <typename T, typename... Args> inline void rd(T &x, Args &...args) {
    rd(x);
    rd(args...);
}
template <typename T> inline void writeInt(T x, char space = '\n') {
    if (x < 0) {
        cout << "-";
        x = -x;
    }
    static int sta[41];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48);
    if (space) putchar(space);
}

template <typename T, typename... Args> inline void writeInt(T x, Args ...r) {
    writeInt(x, ' ');
    writeInt(r..., ' ');
    cout << endl;
}
template <typename T>
concept extended_integral = integral<T> or is_same_v<T, __int128>;
template <typename T> requires extended_integral<T> inline void writeVector(const vector<T>& x) {
    for (auto e : x) {
        writeInt(e, ' ');
    }
    cout << endl;
}
template <typename T> inline void writeVector(const vector<T>& x) {
    for (auto e : x) {
        cout << e << ' ';
    }
    cout << endl;
}
void yes() {
    cout << "Yes" << endl;
}
void no() {
    cout << "No" << endl;
}
// ----------------- Item Get Border Line! -----------------
#define MULTI
void Main() {
    int n, m, k;
    rd(n, m, k);
    
    vector<int> a(n + 12);
    a[n + 1] = -1;
    repn(i, n) rd(a[i]);
    set<int> s;
    repn(i, n) s.insert(a[i]);
    if (s.size() == 1) {
        cout << ceil(n /(double) k) << endl;
        return;
    }
    vector<int> blockSize;
    int cur = 0;
    repn(i, n + 1) {
        if (a[i] != a[i - 1] && i != 1) {
            blockSize.push_back(cur);
            cur = 1;
        } else {
            cur++;
        }
    }
    if (a[n] == a[1]) {
        auto b = blockSize.back();
        blockSize.pop_back();
        blockSize[0] += b;
    }
    int ans = 0;
    bool flag = false;
    for (auto x: blockSize) {
        if (x >= k) flag = true;
        ans += ceil(x / (double)k);
    }
    if (!flag) cout << -1 << endl;
    else cout << ans << endl;
}
    

int main() {
#ifdef MULTI
    int T;
    rd(T);
    while (T--)
#endif
        Main();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3860kb

input:

3
11 4 2
1 1 1 2 2 3 3 3 4 4 1
5 2 1
1 2 1 2 1
6 2 2
1 2 1 2 1 2

output:

6
5
-1

result:

ok 3 number(s): "6 5 -1"

Test #2:

score: 0
Accepted
time: 52ms
memory: 3988kb

input:

62500
16 2 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 2 2 1 1 1 1 ...

output:

16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
...

result:

ok 62500 numbers

Test #3:

score: 0
Accepted
time: 3ms
memory: 3820kb

input:

3036
16 2 1
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 2 1 2 1 2 1 1...

output:

16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
...

result:

ok 3036 numbers

Test #4:

score: 0
Accepted
time: 48ms
memory: 4060kb

input:

62500
16 2 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 2 2 1 1 1 1 ...

output:

8
9
9
8
9
10
8
9
9
9
10
9
8
9
9
8
9
10
9
9
10
11
9
10
8
9
9
9
9
10
8
9
9
9
10
9
9
10
9
9
10
10
11
10
9
10
10
9
8
9
9
8
9
10
9
9
9
9
10
9
8
9
9
8
9
10
9
9
10
11
9
10
9
10
10
10
9
10
9
9
10
11
10
10
11
12
10
11
9
10
10
10
10
11
9
10
8
9
9
9
9
10
8
9
9
10
10
10
9
10
9
9
9
10
9
9
10
11
9
10
8
9
9
9
9
10...

result:

ok 62500 numbers

Test #5:

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

input:

3036
16 2 2
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 2 1 2 1 2 1 1...

output:

10
11
10
10
11
11
12
11
10
11
11
10
9
10
10
9
10
11
10
10
10
10
11
10
9
10
10
9
10
11
11
10
11
12
11
11
11
11
12
11
10
11
11
10
11
12
12
11
12
13
12
12
11
11
12
11
11
12
11
11
10
10
11
10
10
11
10
10
11
11
12
11
10
11
11
10
10
11
11
10
11
12
11
11
10
10
11
10
10
11
10
10
10
10
11
10
10
11
10
10
11
1...

result:

ok 3036 numbers

Test #6:

score: 0
Accepted
time: 28ms
memory: 3836kb

input:

62500
16 2 3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 2 2 1 1 1 1 ...

output:

6
6
6
6
6
8
6
6
6
7
8
7
6
7
6
6
6
7
7
7
8
9
7
7
6
7
7
7
6
7
6
6
6
8
7
7
7
9
7
7
8
9
9
9
7
9
7
8
6
7
7
7
7
9
7
7
6
7
7
7
6
8
6
6
6
7
8
7
7
8
7
6
7
8
9
8
7
8
7
7
8
8
9
8
9
10
9
8
7
8
9
8
7
8
8
7
6
7
7
6
7
8
7
6
7
8
9
8
7
8
7
7
6
6
7
6
7
8
7
6
6
7
8
7
6
7
6
6
6
7
7
7
8
9
7
7
7
8
8
8
7
8
6
7
7
8
8
8
9
1...

result:

ok 62500 numbers

Test #7:

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

input:

3036
16 2 3
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 2 1 2 1 2 1 1...

output:

10
10
10
9
10
10
12
10
10
10
10
9
9
8
10
8
10
10
10
9
8
8
10
8
9
9
9
8
8
8
10
8
9
9
9
8
9
9
11
9
9
9
9
8
10
9
11
9
11
11
11
10
9
9
11
9
9
9
10
8
8
8
9
7
9
9
9
8
9
9
11
9
9
9
9
8
8
7
9
7
9
9
9
8
8
8
10
8
8
8
8
7
9
8
10
8
10
10
10
9
9
9
11
9
9
9
9
8
10
9
11
9
11
11
11
10
9
9
11
9
9
9
10
8
10
10
11
9
1...

result:

ok 3036 numbers

Test #8:

score: 0
Accepted
time: 58ms
memory: 3840kb

input:

62500
16 2 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 2 2 1 1 1 1 ...

output:

4
5
5
5
5
7
5
5
5
6
7
6
5
6
5
4
5
6
6
6
7
8
6
6
5
6
6
6
5
6
4
5
5
6
6
6
6
8
6
6
7
8
8
8
6
8
6
6
5
6
6
6
6
8
6
6
5
6
6
6
4
6
5
5
5
7
6
6
6
8
6
6
6
8
8
8
6
8
6
6
7
8
8
8
8
10
8
8
6
8
8
8
6
8
6
7
5
6
6
6
6
8
6
6
6
8
8
8
6
8
6
6
5
6
6
6
6
8
6
6
4
6
6
6
5
7
5
5
5
6
7
6
6
7
6
5
6
7
8
7
6
7
6
5
6
7
8
7
8
9...

result:

ok 62500 numbers

Test #9:

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

input:

3036
16 2 4
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 2 1 2 1 2 1 1...

output:

8
9
8
7
8
9
10
9
8
9
8
7
6
7
8
7
8
9
8
7
6
7
8
7
6
7
7
6
7
8
8
7
8
9
8
7
8
9
10
9
8
9
8
7
8
9
10
9
10
11
10
9
8
9
10
9
8
9
8
8
7
7
8
7
8
9
8
7
8
9
10
9
8
9
8
7
6
7
8
7
8
9
8
7
6
7
8
7
7
8
7
6
7
8
9
8
8
9
8
7
8
9
10
9
8
9
8
7
8
9
10
9
10
11
10
9
8
9
10
9
8
9
8
8
9
9
10
9
10
11
10
9
10
11
12
11
10
11
...

result:

ok 3036 numbers

Test #10:

score: 0
Accepted
time: 43ms
memory: 3920kb

input:

62500
16 2 5
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 2 2 1 1 1 1 ...

output:

4
4
4
4
4
6
4
4
4
6
6
6
4
6
4
4
4
6
6
6
6
8
6
6
4
6
6
6
4
6
4
4
4
5
6
5
6
7
6
5
6
7
8
7
6
7
6
5
4
5
6
5
6
7
6
5
4
5
6
5
4
5
4
4
4
5
5
5
6
7
5
5
6
7
7
7
6
7
5
5
6
7
7
7
8
9
7
7
6
7
7
7
6
7
5
5
4
5
5
5
6
7
5
5
6
7
7
7
6
7
5
5
4
5
5
5
6
7
5
5
4
5
5
5
4
5
4
4
4
6
5
5
5
7
5
5
6
7
7
7
5
7
5
5
6
7
7
7
7
9
...

result:

ok 62500 numbers

Test #11:

score: 0
Accepted
time: 3ms
memory: 3768kb

input:

3036
16 2 5
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 2 1 2 1 2 1 1...

output:

-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
6
-1
7
-1
8
-1
7
-1
6
-1
7
-1
6
6
5
7
6
-1
7
-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
8
-1
9
-1
10
-1
9
-1
8
-1
9
-1
8
-1
7
6
6
-1
7
-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
6
-1
7
-1
8
-1
7
-1
6
-1
7
6
6
7
6
7
7
8
7
-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
8
-1
9
-1
10
-1
9
-1
8
-1
9
-1
8
...

result:

ok 3036 numbers

Test #12:

score: 0
Accepted
time: 44ms
memory: 3876kb

input:

62500
16 2 6
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 2 2 1 1 1 1 ...

output:

3
4
4
4
4
6
4
4
4
5
6
5
4
5
4
3
4
5
5
5
6
7
5
5
4
5
5
5
4
5
3
3
4
5
5
5
5
7
5
5
6
7
7
7
5
7
5
5
4
5
5
5
5
7
5
5
4
5
5
5
3
5
3
3
4
5
5
5
5
7
5
5
5
7
7
7
5
7
5
5
6
7
7
7
7
9
7
7
5
7
7
7
5
7
5
5
4
5
5
5
5
7
5
5
5
7
7
7
5
7
5
5
4
5
5
5
5
7
5
5
3
5
5
5
3
5
3
4
4
5
5
5
5
7
5
5
5
7
7
7
5
7
5
5
5
7
7
7
7
9
...

result:

ok 62500 numbers

Test #13:

score: 0
Accepted
time: 53ms
memory: 3920kb

input:

62500
16 2 15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 2 2 ...

output:

2
2
2
-1
2
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

result:

ok 62500 numbers

Test #14:

score: 0
Accepted
time: 64ms
memory: 3784kb

input:

62500
16 2 16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 2 2 ...

output:

1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 62500 numbers

Test #15:

score: 0
Accepted
time: 6ms
memory: 3820kb

input:

3036
16 2 16
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 2 1 2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 3036 numbers

Test #16:

score: 0
Accepted
time: 13ms
memory: 7416kb

input:

1
999996 5 10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...

output:

122055

result:

ok 1 number(s): "122055"

Test #17:

score: 0
Accepted
time: 9ms
memory: 7408kb

input:

1
999989 5 10
5 5 5 5 5 5 5 5 5 5 5 5 5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 ...

output:

122344

result:

ok 1 number(s): "122344"

Test #18:

score: 0
Accepted
time: 30ms
memory: 7580kb

input:

1
999917 1000000 100
880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996...

output:

13292

result:

ok 1 number(s): "13292"

Test #19:

score: 0
Accepted
time: 30ms
memory: 7652kb

input:

1
999953 1000000 100
877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398...

output:

13245

result:

ok 1 number(s): "13245"

Test #20:

score: 0
Accepted
time: 37ms
memory: 7052kb

input:

1
999408 1000000 1000
465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 46559...

output:

1336

result:

ok 1 number(s): "1336"

Test #21:

score: 0
Accepted
time: 20ms
memory: 6976kb

input:

1
994353 1000000 10000
34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 3...

output:

130

result:

ok 1 number(s): "130"

Test #22:

score: 0
Accepted
time: 18ms
memory: 6704kb

input:

1
933043 1000000 100000
224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224...

output:

12

result:

ok 1 number(s): "12"

Test #23:

score: 0
Accepted
time: 22ms
memory: 6948kb

input:

1
994769 1000000 500000
277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277...

output:

2

result:

ok 1 number(s): "2"

Test #24:

score: 0
Accepted
time: 17ms
memory: 6772kb

input:

1
895242 1000000 500000
560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560...

output:

-1

result:

ok 1 number(s): "-1"

Test #25:

score: 0
Accepted
time: 14ms
memory: 7048kb

input:

1
1000000 1000000 985319
114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 11...

output:

2

result:

ok 1 number(s): "2"

Test #26:

score: 0
Accepted
time: 17ms
memory: 7032kb

input:

1
1000000 1000000 1000000
114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 1...

output:

1

result:

ok 1 number(s): "1"

Test #27:

score: 0
Accepted
time: 14ms
memory: 7028kb

input:

1
1000000 1000000 514
114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 11451...

output:

1946

result:

ok 1 number(s): "1946"

Test #28:

score: 0
Accepted
time: 35ms
memory: 13076kb

input:

1
1000000 1000000 7
19 13 25 40 35 31 13 15 13 24 30 15 6 20 35 26 13 13 37 5 26 30 28 10 40 32 32 26 7 31 30 29 24 23 36 12 31 37 10 39 9 30 4 35 6 25 14 16 2 32 27 18 15 8 40 14 8 10 16 7 32 38 20 5 20 35 25 13 20 26 31 29 4 27 10 29 32 9 17 38 18 17 2 12 19 19 23 3 28 25 2 15 13 11 17 16 26 28 7 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #29:

score: 0
Accepted
time: 39ms
memory: 13072kb

input:

1
1000000 1000000 12
36 31 24 39 11 22 1 14 32 21 20 1 22 16 31 26 30 35 28 12 38 38 4 33 27 5 25 3 15 26 15 16 23 21 30 24 11 40 22 31 32 32 18 12 40 7 24 13 8 33 23 39 7 39 13 7 7 3 4 26 6 9 10 4 17 28 39 8 23 34 29 12 37 5 34 29 33 8 26 2 27 30 20 32 15 23 27 40 6 29 31 15 33 21 12 20 2 22 34 17 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #30:

score: 0
Accepted
time: 36ms
memory: 11720kb

input:

1
1000000 1000000 5
26 34 34 8 28 23 31 37 24 5 9 11 13 9 23 19 16 40 2 13 13 29 18 28 25 26 4 4 30 38 2 27 24 26 39 35 15 26 19 30 9 27 37 32 37 26 19 14 1 14 32 27 5 20 40 10 32 12 25 16 35 11 14 31 10 23 16 29 8 36 40 1 22 24 18 23 14 32 38 38 30 30 10 8 9 15 16 8 29 8 18 32 12 40 21 26 13 4 14 3...

output:

-1

result:

ok 1 number(s): "-1"

Test #31:

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

input:

1
1 1 1
1

output:

1

result:

ok 1 number(s): "1"

Test #32:

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

input:

6
1 9 1
9
9 1 1
1 1 1 1 1 1 1 1 1
2 1 1
1 1
2 1 2
1 1
2 9 2
8 8
3 3 2
1 2 3

output:

1
9
2
1
1
-1

result:

ok 6 numbers