QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#186864#6718. Масив i частковi сумиCyanmond43 10ms4668kbC++171.6kb2023-09-24 12:44:502023-09-24 12:44:51

Judging History

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

  • [2023-09-24 12:44:51]
  • 评测
  • 测评结果:43
  • 用时:10ms
  • 内存:4668kb
  • [2023-09-24 12:44:50]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define rep(i, l, r) for (int i = (l); i < (r); ++i)
#define per(i, l, r) for (int i = (r - 1); i >= l; --i)
#define ALL(x) (x).begin(), (x).end()

using i64 = long long;

void main_() {
    int N, G;
    cin >> N >> G;
    vector<i64> A(N);
    for (auto &e : A) cin >> e;
    if (G == 2) {
        i64 f = 0;
        for (const auto e : A) {
            if (e != 0) {
                f = e;
                break;
            }
        }
        if (f == 0) {
            cout << 0 << endl;
        } else {
            if (f == 1) {
                cout << 100 << endl;
                rep(i, 0, 100) cout << 2 << ' ' << 1 << ' ' << N << endl;
            } else {
                cout << 100 << endl;
                rep(i, 0, 99) cout << 2 << ' ' << 1 << ' ' << N << endl;
                cout << 1 << endl;
            }
        }
    }
    if (G == 5 or G == 6) {
        vector<pair<int, int>> ans;
        while (any_of(ALL(A), [](i64 x) { return x < 0; })) {
            __int128_t sum = 0;
            int r = N - 1;
            rep(i, 0, N) {
                sum += A[i];
                if (sum < A[i]) {
                    r = i - 1;
                    break;
                } else {
                    A[i] = sum;
                }
            }
            ans.push_back({0, r});
        }
        cout << ans.size() << endl;
        for (const auto &[a, b] : ans) cout << 2 << ' ' << a + 1 << ' ' << b + 1 << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    main_();
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 9ms
memory: 4628kb

input:

200000 1
1 1 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0...

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #2:

score: 17
Accepted

Test #5:

score: 17
Accepted
time: 9ms
memory: 4588kb

input:

200000 2
1 1 0 0 1 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 0...

output:

100
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000...

result:

ok OK: 100 operations

Test #6:

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

input:

200000 2
0 0 -1 -1 0 -1 0 0 -1 -1 0 -1 -1 0 -1 0 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 -1 0 0 0 -1 -1 0 0 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 0 -1 0 0 0 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1...

output:

100
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000...

result:

ok OK: 100 operations

Test #7:

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

input:

200000 2
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

100
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000...

result:

ok OK: 100 operations

Test #8:

score: 0
Accepted
time: 5ms
memory: 4568kb

input:

200000 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 -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 -...

output:

100
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000...

result:

ok OK: 100 operations

Test #9:

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

input:

200000 2
1 1 0 0 1 0 0 0 0 0 0 0 1 0 0 -1 0 0 0 0 -1 0 -1 0 -1 0 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 0 0 0 0 -1 -1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 -1 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 -1 0 0 0 0 -1 0 0 0 1 0 0 -1 0 -1 0 0 0 0 0 -1 0 0 0 -1 -1 0 0 0 -1 0 -1 0 0 0 0 0 0 ...

output:

100
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000...

result:

ok OK: 100 operations

Test #10:

score: 0
Accepted
time: 10ms
memory: 4636kb

input:

200000 2
-1 0 1 -1 0 1 1 0 1 0 0 1 0 1 -1 1 1 -1 1 -1 -1 0 -1 -1 0 -1 0 0 0 1 1 0 -1 1 -1 0 1 0 1 -1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 0 1 -1 0 -1 1 -1 0 -1 1 -1 0 1 1 1 0 -1 0 -1 -1 -1 -1 0 0 -1 1 -1 -1 0 1 -1 0 0 0 0 0 0 1 1 1 0 -1 0 -1 1 -1 1 -1 1 1 0 0 1 1 -1 1 1 -1 -1 1 0 -1 1 -1 0 0 0 -1 0 0 1 1 -1 ...

output:

100
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000
2 1 200000...

result:

ok OK: 100 operations

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #11:

score: 0
Wrong Answer
time: 4ms
memory: 4596kb

input:

200000 3
0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 1 1 1 0 0 0 0 1 1 0 1 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 0 1 0...

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 7
Accepted

Test #28:

score: 7
Accepted
time: 1ms
memory: 3528kb

input:

2891 5
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 ...

output:

2
2 1 139
2 1 2891

result:

ok OK: 2 operations

Test #29:

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

input:

2847 5
1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 0 -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 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

2
2 1 135
2 1 2847

result:

ok OK: 2 operations

Test #30:

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

input:

2981 5
1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 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 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

2
2 1 139
2 1 2981

result:

ok OK: 2 operations

Test #31:

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

input:

3000 5
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2
2 1 1507
2 1 3000

result:

ok OK: 2 operations

Test #32:

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

input:

3000 5
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2
2 1 1507
2 1 3000

result:

ok OK: 2 operations

Subtask #6:

score: 19
Accepted

Dependency #5:

100%
Accepted

Test #33:

score: 19
Accepted
time: 6ms
memory: 4604kb

input:

191855 6
1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 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 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1...

output:

2
2 1 1124
2 1 191855

result:

ok OK: 2 operations

Test #34:

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

input:

191982 6
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 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1...

output:

2
2 1 1136
2 1 191982

result:

ok OK: 2 operations

Test #35:

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

input:

193538 6
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 0 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 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 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0...

output:

2
2 1 1127
2 1 193538

result:

ok OK: 2 operations

Test #36:

score: 0
Accepted
time: 8ms
memory: 4612kb

input:

200000 6
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2
2 1 100007
2 1 200000

result:

ok OK: 2 operations

Test #37:

score: 0
Accepted
time: 5ms
memory: 4572kb

input:

200000 6
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2
2 1 100007
2 1 200000

result:

ok OK: 2 operations

Subtask #7:

score: 0
Wrong Answer

Dependency #5:

100%
Accepted

Test #38:

score: 0
Wrong Answer
time: 0ms
memory: 3484kb

input:

3000 7
1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 1 0 1 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0...

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #8:

score: 0
Skipped

Dependency #1:

0%