| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 866914 | epicci23 | Lampice (COCI21_lampice) | C++17 | 1 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define endl "\n"
#define int long long
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
void solve(){
int n,k;
cin >> n >> k;
int ar[n+1];
for(int i=1;i<=n;i++) cin >> ar[i];
for(int l=1;l<=n;l++){
for(int r=n;r>=l;r--){
if((r-l+1)%k) continue;
bool ok=1;
int u=(r-l+1)/k;
for(int x=l;x+u<=r;x+=u)
for(int j=x;j<=x+u-1;j++)
if(ar[j]!=ar[j+u]) ok=0;
if(ok){
cout << u << endl;
for(int j=l;j<l+u;j++) cout << ar[j] << " \n"[j==l+u-1];
return;
}
}
}
cout << -1 << endl;
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int t=1;//cin >> t;
while(t--) solve();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
