# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
448710 | 2021-07-31T20:34:33 Z | Antekb | Drvca (COCI19_drvca) | C++14 | 51 ms | 1180 KB |
#include<bits/stdc++.h> using namespace std; bool czy(vector<int> V){ if(V.size()==0)return 0; if(V.size()==1)return 1; int d=V[1]-V[0]; for(int i=1; i<V.size(); i++)if(V[i]-V[i-1]!=d)return 0; return 1; } void out(vector<int> V){ cout<<V.size()<<"\n"; for(int i:V)cout<<i<<" "; cout<<"\n"; } vector<int> V; bool roz(int a, int d){ vector<int> A, B; for(int i:V){ if(i==a)A.push_back(i), a+=d; else B.push_back(i); } if(czy(B)){ out(A); out(B); return 1; } B.push_back(A.back()); sort(B.begin(), B.end()); A.pop_back(); if(A.size() && czy(B)){ out(A); out(B); return 1; } return 0; } int main(){ int n; cin>>n; V.resize(n); for(int &i:V)cin>>i; sort(V.begin(), V.end()); for(int i=1; i<n; i++)assert(V[i]!=V[i-1]); if(roz(V[0], V[1]-V[0]))return 0; if(n==2){ //cout<<1<<"\n"<<V[0]<<"\n"<<1<<"\n"<<V[1]<<"\n"; return 0; } if(roz(V[0], V[2]-V[0]))return 0; if(roz(V[1], V[2]-V[1]))return 0; cout<<-1; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Runtime error | 1 ms | 332 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Runtime error | 1 ms | 332 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 51 ms | 1180 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Runtime error | 1 ms | 332 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |