Editorial for Bedao Mini Contest 02 - RANDOM
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Code mẫu
#include<bits/stdc++.h> using namespace std; #define task "long" #define MAX int(2e5)+5 typedef pair<int, int> ii; void init() { if (fopen(task".inp","r")) { freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } } void fastio() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int n, a[10005], cnt[105]; int t; int main() { fastio(); init(); cin >> t; while(t--) { cin >> n; for(int i=1; i<=n; i++) cin >> a[i], cnt[a[i]]++; for(int i=0, p=0; i<=100; i++) { while(cnt[i] > 0) a[++p] = i, cnt[i]--; } if (a[n/4] == a[n/4 + 1] || a[2*n/4] == a[2*n/4 + 1] || a[3*n/4] == a[3*n/4 + 1]) cout << -1 << "\n"; else cout << a[n/4+1] << " " << a[2*n/4 + 1] << " " << a[3*n/4 + 1] << "\n"; } }
Comments