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

#TimeUsernameProblemLanguageResultExecution timeMemory
442970Wasif_JamilNivelle (COCI20_nivelle)C++14
0 / 110
13 ms844 KiB
// "Say:He is the Most Merciful,We have believed in him and upon him we have relied" [67:29] #include<bits/stdc++.h> using namespace std; bool is(vector<int>&v){ if((int)v.size() == 1)return 1; int d = abs(v[0] - v[1]); for(int i=0; i<(int)v.size()-1; i++){ if((v[i+1] - v[i]) != d)return 0; } return 1; } void print(vector<int>&a, vector<int>&b){ cout << (int)a.size() << "\n"; for(int e:a)cout << e << " "; cout << '\n'; cout << (int)b.size() << '\n'; for(int e:b)cout << e << ' '; cout << '\n'; } int main(){ int n; cin >> n; vector<int>v(n); map<int, int>mp; for(int i=0; i<n; i++){ cin >> v[i]; mp[v[i]]++; } sort(v.begin(), v.end()); if(n == 2){ vector<int>a = {v[0]}, b = {v[1]}; print(a, b); return 0; } if(n == 3){ vector<int>a = {v[0], v[1]}, b = {v[2]}; print(a, b); return 0; } if(is(v)){ cout << (n>>1) << '\n'; for(int i=0; i<(n>>1); i++)cout << v[i] << ' '; cout << '\n' << (n>>1) << '\n'; for(int i=n>>1; i<n; i++)cout << v[i] << ' '; cout << '\n'; return 0; } vector<int>a, b; int d = v[1] - v[0]; a.push_back(v[0]); a.push_back(v[1]); int ind = 1; for(int i=2; i<n; i++){ if(v[i] == v[ind]+d)a.push_back(v[i]), ind = i; else b.push_back(v[i]); } if(is(a) and is(b)){ print(a, b); }else { a.clear(); b.clear(); a.push_back(v[0]); b.push_back(v[1]); a.push_back(v[2]); d = v[2] - v[0], ind = 2; for(int i=3; i<n; i++){ if(v[i] == v[ind]+d)a.push_back(v[i]), ind = i; else b.push_back(v[i]); } if(is(a) and is(b)){ print(a, b); }else { a.clear(); b.clear(); a.push_back(v[0]); b.push_back(v[1]); b.push_back(v[2]); d = v[2] - v[1], ind = 2; for(int i=3; i<n; i++){ if(v[i] == v[ind]+d)b.push_back(v[i]), ind = i; else a.push_back(v[i]); } print(a, b); } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...