Submission #900048

#TimeUsernameProblemLanguageResultExecution timeMemory
900048HamzaTLampice (COCI21_lampice)C++14
0 / 50
1 ms2396 KiB
//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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...