(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #765678

#TimeUsernameProblemLanguageResultExecution timeMemory
7656781075508020060209tcDrvca (COCI19_drvca)C++14
0 / 110
48 ms4196 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n; int ar[200005]; int sfok[200005]; int sfokv[200005]; void CHK(vector<int>A,vector<int>B){ for(int i=1;i<A.size();i++){ if(A[i]-A[i-1]!=A[1]-A[0]){ return; } } for(int i=1;i<B.size();i++){ if(B[i]-B[i-1]!=B[1]-B[0]){ return; } } if(B.size()==0){ B.push_back(A.back()); A.pop_back(); } cout<<A.size()<<endl; for(int i=0;i<A.size();i++){ cout<<A[i]<<" "; }cout<<endl; A=B; cout<<A.size()<<endl; for(int i=0;i<A.size();i++){ cout<<A[i]<<" "; }cout<<endl;exit(0); } signed main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>ar[i]; } if(n==2){ cout<<"1\n"; cout<<ar[1]<<endl; cout<<"1\n"; cout<<ar[2]<<endl;return 0; } sort(ar+1,ar+n+1); sfok[n]=1; for(int i=n-1;i>=1;i--){ if(ar[i]-ar[i+1]!=ar[n-1]-ar[n]){ break; } sfok[i]=1; } vector<int>A; vector<int>B; A.push_back(ar[1]); A.push_back(ar[2]); for(int i=3;i<=n;i++){ if(ar[i]-A.back()!=ar[2]-ar[1]){ B.push_back(ar[i]); }else{ A.push_back(ar[i]); } } CHK(A,B); A.clear();B.clear(); A.push_back(ar[1]); A.push_back(ar[3]); B.push_back(ar[2]); for(int i=4;i<=n;i++){ if(ar[i]-A.back()!=ar[3]-ar[1]){ B.push_back(ar[i]); }else{ A.push_back(ar[i]); } } CHK(A,B); A.clear();B.clear(); A.push_back(ar[2]); A.push_back(ar[3]); B.push_back(ar[1]); for(int i=4;i<=n;i++){ if(ar[i]-A.back()!=ar[3]-ar[2]){ B.push_back(ar[i]); }else{ A.push_back(ar[i]); } } CHK(A,B); // A.clear(); B.clear(); A.push_back(ar[1]); A.push_back(ar[2]); for(int i=3;i<=n;i++){ if(ar[i]-A.back()!=ar[2]-ar[1]){ B.push_back(ar[i]); }else{ if(B.size()<=1||((ar[i]-B.back())==(B[1]-B[0]))){ B.push_back(ar[i]);continue; } A.push_back(ar[i]); } } CHK(A,B); A.clear();B.clear(); A.push_back(ar[1]); A.push_back(ar[3]); B.push_back(ar[2]); for(int i=4;i<=n;i++){ if(ar[i]-A.back()!=ar[3]-ar[1]){ B.push_back(ar[i]); }else{ if(B.size()<=1||((ar[i]-B.back())==(B[1]-B[0]))){ B.push_back(ar[i]);continue; } A.push_back(ar[i]); } } CHK(A,B); A.clear();B.clear(); A.push_back(ar[2]); A.push_back(ar[3]); B.push_back(ar[1]); for(int i=4;i<=n;i++){ if(ar[i]-A.back()!=ar[3]-ar[2]){ B.push_back(ar[i]); }else{ if(B.size()<=1||((ar[i]-B.back())==(B[1]-B[0]))){ B.push_back(ar[i]);continue; } A.push_back(ar[i]); } } CHK(A,B); // cout<<-1; }

Compilation message (stderr)

drvca.cpp: In function 'void CHK(std::vector<long long int>, std::vector<long long int>)':
drvca.cpp:12:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | for(int i=1;i<A.size();i++){
      |             ~^~~~~~~~~
drvca.cpp:17:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 | for(int i=1;i<B.size();i++){
      |             ~^~~~~~~~~
drvca.cpp:27:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 | for(int i=0;i<A.size();i++){
      |             ~^~~~~~~~~
drvca.cpp:32:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 | for(int i=0;i<A.size();i++){
      |             ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...