제출 #442881

#제출 시각아이디문제언어결과실행 시간메모리
442881Abrar_Al_SamitDrvca (COCI19_drvca)C++17
0 / 110
20 ms716 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define debug(x) cerr << '[' << (#x) << "] = " << x << '\n'; template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update> ; void PlayGround() { int N; cin >> N; vector<int>a(N); for(int i=0; i<N; ++i) cin >> a[i]; sort(a.begin(), a.end()); if(N < 4) { cout << 1 << '\n' << a[0] << '\n' << N-1 << '\n'; for(int i=1; i<N; ++i) cout << a[i] << ' '; cout << '\n'; return; } vector<int>b = {0, 1, 2, 3}; do { vector<int>x = {a[b[0]], a[b[1]]}; vector<int>y = {a[b[2]], a[b[3]]}; if(x[0]>x[1]) swap(x[0], x[1]); if(y[0]>y[1]) swap(y[0], y[1]); for(int i=4; i<N; ++i) { if(a[i]-x.back()==x[1]-x[0]) x.push_back(a[i]); else if(a[i]-y.back()==y[1]-y[0]) y.push_back(a[i]); else break; } if(x.size()+y.size()==N) { if(y.empty()) y.push_back(x.back()), x.pop_back(); cout << x.size() << '\n'; for(auto it : x) cout << it << ' '; cout << '\n'; cout << y.size() << '\n'; for(auto it : y) cout << it << ' '; cout << "\n"; return; } } while(next_permutation(b.begin(), b.end())); cout << -1 << '\n'; #ifndef ONLINE_JUDGE cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // #endif PlayGround(); return 0; }

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

drvca.cpp: In function 'void PlayGround()':
drvca.cpp:38:29: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |         if(x.size()+y.size()==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...