CSES - Datatähti 2025 loppu - Results
Submission details
Task:Poistot
Sender:maweiyin24562
Submission time:2025-01-18 14:52:03 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 3details
#20.01 s1, 2, 3details
#3ACCEPTED0.01 s1, 3details
#40.01 s1, 3details
#50.05 s2, 3details
#60.04 s2, 3details
#70.10 s3details
#8ACCEPTED0.09 s3details
#90.07 s3details
#100.07 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:30:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   30 |             mid=l+r>>1;
      |                 ~^~
input/code.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int j=1;j<li[i].size();j++){
      |                     ~^~~~~~~~~~~~~

Code

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define lbit(u) (u&(-u))

const int N=100009;

vector<int> li[N];
int sz=1;


int n;

int main(){
    cin>>n;
    int fi;
    cin>>fi;
    li[0].push_back(fi);
    for(int i=2;i<=n;i++){
        int a;
        cin>>a;
        // if(a<li[sz-1][li[sz-1].size()-1]){
        //     sz++;
        //     li[sz-1].push_back(a);
        //     continue;
        // }
        int l=0,r=sz,mid=0;
        while(l<r){
            mid=l+r>>1;
            if(li[mid][li[mid].size()-1]>=a){
                l=mid+1;
            }
            else r=mid;
        }
        li[l].push_back(a);
    }
    cout<<sz<<endl;
    for(int i=0;i<sz;i++){
        cout<<li[i][0];
        for(int j=1;j<li[i].size();j++){
            cout<<' '<<li[i][j];
        }
        cout<<endl;
    }
    return 0;
}

/*

*/

Test details

Test 1

Group: 1, 3

Verdict:

input
1000
447773962 773442532 122816 137...

correct output
53
447773962 773442532 908719430 ...

user output
1
447773962 773442532 908719430 ...
Truncated

Test 2

Group: 1, 2, 3

Verdict:

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

correct output
1000




...

user output
1
1

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

Test 4

Group: 1, 3

Verdict:

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

correct output
1000
1000 
999 
998 
997 
...

user output
1
1000

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
1
1

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
1
5 10

Test 7

Group: 3

Verdict:

input
200000
591414747 75940263 760367935 9...

correct output
879
591414747 760367935 901888417 ...

user output
1
591414747 760367935 901888417 ...
Truncated

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

Test 9

Group: 3

Verdict:

input
200000
200000 199999 199998 199997 19...

correct output
200000
200000 
199999 
199998 
199997 
...

user output
1
200000

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
1
199999 200000