Submission #1067425

# Submission time Handle Problem Language Result Execution time Memory
1067425 2024-08-20T16:51:16 Z soncao Drvca (COCI19_drvca) C++17
20 / 110
16 ms 1808 KB
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ii pair<int,int>
#define lll pair<ll,ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<ii>
int n,a[100005];
void sub1()
{
    for(int i=1;i<(1<<n);i++){
        vi a1,a2;
        for(int j=0;j<n;j++){
            if((i>>j)&1)a1.push_back(a[j+1]);
            else a2.push_back(a[j+1]);
        }
        int ok=1;
        int cur;
        if(a1.size()>1){
        cur=a1[1]-a1[0];
        for(int j=1;j<a1.size();j++){
            if(a1[j]-a1[j-1]!=cur){ok=0;break;}
        }}
        if(a2.size()>1){
        cur=a2[1]-a2[0];
        for(int j=1;j<a2.size();j++){
            if(a2[j]-a2[j-1]!=cur){
                ok=0;break;
            }
        }}
        if(ok==0)continue;
        cout<<a1.size()<<'\n';
        for(int cc:a1)cout<<cc<<' ';
        cout<<'\n'<<a2.size()<<'\n';
        for(int cc:a2)cout<<cc<<' ';
        return;
    }
    cout<<-1;
}
void sc()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+n+1);
    sub1();
}
int main()
{
    ios_base :: sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
    sc() ;
    return 0 ; ///sc
}

Compilation message

drvca.cpp: In function 'void sub1()':
drvca.cpp:22:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for(int j=1;j<a1.size();j++){
      |                     ~^~~~~~~~~~
drvca.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int j=1;j<a2.size();j++){
      |                     ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 464 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 8 ms 460 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 9 ms 348 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 464 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 8 ms 460 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 9 ms 348 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Incorrect 3 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 464 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 8 ms 460 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 9 ms 348 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Incorrect 3 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -