(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.

제출 #811164

#제출 시각아이디문제언어결과실행 시간메모리
811164pccDrvca (COCI19_drvca)C++14
0 / 110
47 ms8644 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second const int mxn = 1e5+10; int n; ll arr[mxn]; void check(ll start,ll d){ ll now = start; multiset<ll> st; vector<ll> v; for(int i = 0;i<n;i++)st.insert(arr[i]); while(st.find(now) != st.end()){ st.erase(st.find(now)); v.push_back(now); now += d; } vector<ll> tmp; for(auto &i:st)tmp.push_back(i); if(tmp.empty()){ cout<<v.size()-1<<'\n'; for(int i = 0;i<v.size()-1;i++)cout<<v[i]<<' '; cout<<"\n1\n"<<v.back()<<'\n'; exit(0); } else if(tmp.size()<=2){ cout<<v.size()<<'\n'; for(auto &i:v)cout<<i<<' ';cout<<'\n'; cout<<tmp.size()<<'\n'; for(auto &i:tmp)cout<<i<<' ';cout<<'\n'; exit(0); } d = tmp[1]-tmp[0]; for(int i = 1;i<tmp.size();i++){ if(tmp[i]-tmp[i-1] != d)return; } cout<<v.size()<<'\n'; for(auto &i:v)cout<<i<<' ';cout<<'\n'; cout<<tmp.size()<<'\n'; for(auto &i:tmp)cout<<i<<' ';cout<<'\n'; exit(0); } int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n; for(int i = 0;i<n;i++)cin>>arr[i]; sort(arr,arr+n); check(arr[0],arr[1]-arr[0]); check(arr[1],arr[2]-arr[1]); cout<<"-1"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

drvca.cpp: In function 'void check(long long int, long long int)':
drvca.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for(int i = 0;i<v.size()-1;i++)cout<<v[i]<<' ';
      |                 ~^~~~~~~~~~~
drvca.cpp:34:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   34 |   for(auto &i:v)cout<<i<<' ';cout<<'\n';
      |   ^~~
drvca.cpp:34:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   34 |   for(auto &i:v)cout<<i<<' ';cout<<'\n';
      |                              ^~~~
drvca.cpp:36:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   36 |   for(auto &i:tmp)cout<<i<<' ';cout<<'\n';
      |   ^~~
drvca.cpp:36:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   36 |   for(auto &i:tmp)cout<<i<<' ';cout<<'\n';
      |                                ^~~~
drvca.cpp:40:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |  for(int i = 1;i<tmp.size();i++){
      |                ~^~~~~~~~~~~
drvca.cpp:44:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   44 |  for(auto &i:v)cout<<i<<' ';cout<<'\n';
      |  ^~~
drvca.cpp:44:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   44 |  for(auto &i:v)cout<<i<<' ';cout<<'\n';
      |                             ^~~~
drvca.cpp:46:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   46 |  for(auto &i:tmp)cout<<i<<' ';cout<<'\n';
      |  ^~~
drvca.cpp:46:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   46 |  for(auto &i:tmp)cout<<i<<' ';cout<<'\n';
      |                               ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...