(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 #765690

#TimeUsernameProblemLanguageResultExecution timeMemory
7656901075508020060209tcDrvca (COCI19_drvca)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n; int ar[200005]; int tar[200005]; int sfok[200005]; int chk(vector<int>A){ for(int i=1;i<A.size();i++){ if(A[i]-A[i-1]!=A[1]-A[0]){ return 0; } } return 1; } void ot(vector<int>pl){ vector<int>A; vector<int>B; for(int i=1;i<=n;i++){ tar[i]=0; } for(int i=0;i<pl.size();i++){ tar[pl[i]]=1; } for(int i=1;i<=n;i++){ if(tar[pl[i]]==1){ A.push_back(ar[i]); }else{ B.push_back(ar[i]); } } if(chk(A)&&chk(B)){ if(B.size()==0){ B.push_back(ar[n]); A.pop_back(); } } cout<<A.size()<<endl; for(int i=0;i<A.size();i++){ cout<<A[i]<<" "; }cout<<endl; cout<<B.size()<<endl; for(int i=0;i<B.size();i++){ cout<<B[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.clear();B.clear(); A.push_back(1); A.push_back(2); ot(A); for(int i=3;i<=n;i++){ if(ar[i]-ar[A.back()]==ar[2]-ar[1]){ A.push_back(i); ot(i); } } A.clear(); A.push_back(1); A.push_back(3); ot(A); for(int i=4;i<=n;i++){ if(ar[i]-ar[A.back()]==ar[3]-ar[1]){ A.push_back(i); ot(i); } } A.clear(); A.push_back(2); A.push_back(3); ot(A); for(int i=4;i<=n;i++){ if(ar[i]-ar[A.back()]==ar[3]-ar[2]){ A.push_back(i); ot(i); } } cout<<-1<<endl; }

Compilation message (stderr)

drvca.cpp: In function 'long long int chk(std::vector<long long int>)':
drvca.cpp:11: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]
   11 | for(int i=1;i<A.size();i++){
      |             ~^~~~~~~~~
drvca.cpp: In function 'void ot(std::vector<long long int>)':
drvca.cpp:25: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]
   25 | for(int i=0;i<pl.size();i++){
      |             ~^~~~~~~~~~
drvca.cpp:42: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]
   42 | for(int i=0;i<A.size();i++){
      |             ~^~~~~~~~~
drvca.cpp:46: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]
   46 | for(int i=0;i<B.size();i++){
      |             ~^~~~~~~~~
drvca.cpp: In function 'int main()':
drvca.cpp:81:12: error: could not convert 'i' from 'long long int' to 'std::vector<long long int>'
   81 |         ot(i);
      |            ^
      |            |
      |            long long int
drvca.cpp:91:12: error: could not convert 'i' from 'long long int' to 'std::vector<long long int>'
   91 |         ot(i);
      |            ^
      |            |
      |            long long int
drvca.cpp:101:12: error: could not convert 'i' from 'long long int' to 'std::vector<long long int>'
  101 |         ot(i);
      |            ^
      |            |
      |            long long int