Submission details
Task:Poistot
Sender:MikaelM
Submission time:2025-10-20 19:03:23 +0300
Language:C++ (C++17)
Status:READY
Result:11
Feedback
groupverdictscore
#1ACCEPTED11
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 3details
#2ACCEPTED0.00 s1, 2, 3details
#3ACCEPTED0.00 s1, 3details
#4ACCEPTED0.01 s1, 3details
#5--2, 3details
#6--2, 3details
#7ACCEPTED0.15 s3details
#8ACCEPTED0.04 s3details
#9--3details
#10--3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         while (k < v.size() && v[k].back() >= x) k++;
      |                ~~^~~~~~~~~~
input/code.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         if (k == v.size()) v.push_back({x});
      |             ~~^~~~~~~~~~~

Code

#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define fi first
#define se second
#define pii pair<int,int>
using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;

    vector<vector<int>> v;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        int k = 0;
        while (k < v.size() && v[k].back() >= x) k++;
        if (k == v.size()) v.push_back({x});
        else v[k].push_back(x);
    }

    cout << v.size() << "\n";
    for (auto u : v) {
        for (int x : u) cout << x << " ";
        cout << "\n";
    }
    
    return 0;
}

Test details

Test 1

Group: 1, 3

Verdict: ACCEPTED

input
1000
447773962 773442532 122816 137...

correct output
53
447773962 773442532 908719430 ...

user output
53
447773962 773442532 908719430 ...

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1000




...

user output
1000




...

Test 3

Group: 1, 3

Verdict: ACCEPTED

input
1000
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
1
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

Test 4

Group: 1, 3

Verdict: ACCEPTED

input
1000
1000 999 998 997 996 995 994 9...

correct output
1000
1000 
999 
998 
997 
...

user output
1000
1000 
999 
998 
997 
...

Test 5

Group: 2, 3

Verdict:

input
200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
200000




...

user output
(empty)

Test 6

Group: 2, 3

Verdict:

input
200000
5 2 1 10 6 10 5 5 5 4 4 2 3 7 ...

correct output
20776
5 10 
2 6 10 
1 5 7 9 10 
5 7 8 9 10 
...

user output
(empty)

Test 7

Group: 3

Verdict: ACCEPTED

input
200000
591414747 75940263 760367935 9...

correct output
879
591414747 760367935 901888417 ...

user output
879
591414747 760367935 901888417 ...

Test 8

Group: 3

Verdict: ACCEPTED

input
200000
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
1
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

Test 9

Group: 3

Verdict:

input
200000
200000 199999 199998 199997 19...

correct output
200000
200000 
199999 
199998 
199997 
...

user output
(empty)

Test 10

Group: 3

Verdict:

input
200000
199999 199997 199995 199993 19...

correct output
100000
199999 200000 
199997 199998 
199995 199996 
199993 199994 
...

user output
(empty)