제출 #443076

#제출 시각아이디문제언어결과실행 시간메모리
443076KarliverDrvca (COCI19_drvca)C++14
0 / 110
78 ms11584 KiB
#include <bits/stdc++.h> #define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x) #define all(v) (v).begin(), (v).end() using namespace std; #define forn(i,n) for (int i = 0; i < (n); ++i) #define rforn(i, n) for(int i = (n) - 1;i >= 0;--i) using ll = long long; int mod = (ll)1e9 + 7; #define PI acos(-1) typedef pair<int, int> pairs; const int INF = 1e9 + 1; const int N = 2e5 + 100; const double eps = 1e-7; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <typename XPAX> void ckma(XPAX &x, XPAX y) { x = (x < y ? y : x); } template <typename XPAX> void ckmi(XPAX &x, XPAX y) { x = (x > y ? y : x); } void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) void solve() { int n; cin >> n; V<int>a (n); forn(i, n) cin >> a[i]; sort(all(a)); map<int, int> mp; for(auto t : a) mp[t]++; if(n < 4) { cout << 1 << '\n' << a[0] << '\n'; cout << n - 1 << '\n'; for(int i = 1;i < n;++i)cout << a[i] << ' ' ; exit(0); } auto ck = [&](int f, int s) { V<int> one{f, s}; auto sp = mp; int d = s - f; sp[f]--; sp[s]--; s += d; while(sp[s]) { one.push_back(s); sp[s]--; s += d; } V<int> two; for(auto c : sp) { while(c.second--) two.push_back(c.first); } if(one.size() == n) { two.push_back(one.back()); one.pop_back(); } bool ok = (two.size() > 0); if(two.size() > 1) { d = two[1] - two[0]; for(int i = 2;i < two.size();++i) { if(two[i] - two[i - 1] != d) ok = 0; } } if(ok) { cout << one.size() << '\n'; for(auto c : one) cout << c << ' '; cout << '\n'; cout << two.size() << '\n'; for(auto c : two) cout << c << ' '; exit(0); } }; for(int i = 0;i < 3;++i) { for(int j = i + 1;j < 3;++j) { ck(a[i], a[j]); } } cout << -1 << '\n'; } void test_case() { int t; cin >> t; forn(p, t) { //cout << "Case #" << p + 1 << ": "; solve(); } } int main() { ios::sync_with_stdio(false); cin.tie(0); solve(); }

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

drvca.cpp: In lambda function:
drvca.cpp:98:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   98 |    if(one.size() == n) {
      |       ~~~~~~~~~~~^~~~
drvca.cpp:107:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  107 |     for(int i = 2;i < two.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...