Submission #900048

# Submission time Handle Problem Language Result Execution time Memory
900048 2024-01-07T13:37:58 Z HamzaT Lampice (COCI21_lampice) C++14
0 / 50
1 ms 2396 KB
//struct Edge {int u, v, weight;bool operator<(Edge const& other) {return weight < other.weight;}};
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define sp ' '
#define pb push_back
#define ar for(int i=1;i<=n;i++)
using namespace std;
ll t=1;
const ll N=3e5+100;
ll n,m,q,k;
ll a[N],b[N],c[N];
void solve()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++){cin>>a[i];}
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            if((j-i+1)%k==0)
            {
                set<string>ss;
                string x="";
                for(int kk=i;kk<=j;kk++)
                {
                    x+=to_string(a[kk]);
                    if((kk-i+1)%((j-i+1)/k)==0){ss.insert(x);x="";}
                }
                if(ss.size()==1){auto num=ss.begin();string f=*num;
                cout<<f.size()<<endl;
                for(int kk=i;kk<=i+((j-i+1)/k)-1;kk++)
                {
                    cout<<a[kk]<<" ";
                }
                cout<<endl;return;
                }
            }
        }
    }
    cout<<-1<<endl;return;
}
int main()
{
    //freopen("shell.in", "r", stdin);
   // freopen("shell.out", "w", stdout);
    ios::sync_with_stdio(NULL);
    cin.tie(NULL);cout.tie(NULL);
    // cin>>t;
    while(t--){solve();}
    return 0;
}
//09:00 :: 9:45
//10:30 ::
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB Integer 12 violates the range [-1, 10]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -