Submission #537917

# Submission time Handle Problem Language Result Execution time Memory
537917 2022-03-15T21:40:14 Z inksamurai Lampice (COCI21_lampice) C++17
0 / 50
1 ms 320 KB
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,x,n) for(int i=x;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3HspL4A ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vec(int);
void print(){cout<<"\n";}
template<class T,class...E>
void print(const T&v,const E&...u){cout<<v<<' ',print(u...);}
// e

signed main(){
_3HspL4A;
	int n,k;
	cin>>n>>k;
	vi a(n);
	rep(i,n){
		cin>>a[i];
	}

	auto quq=[&](int l,int r){
		int len=r-l;
		if(len%k) return;
		len/=k;
		vi b;
		rng(i,l,r){
			b.pb(a[i]);
		}
		rep(i,r-l){
			if(b[i]!=b[i%len]){
				return;
			}
		}
		print(len);
		rep(i,len){
			cout<<b[i]<<" ";
		}
		print();
		exit(0);
	};

	rep(i,n){
		rng(j,i+1,n){
			quq(i,j);
		}
	}
//
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
6 Halted 0 ms 0 KB -