Submission #643454

#TimeUsernameProblemLanguageResultExecution timeMemory
643454christinelynnZagonetka (COI18_zagonetka)C++17
0 / 100
75 ms312 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define db double #define pairll pair<ll,ll> #define lpairll pair<ll,pairll> #define repp(i,a,b) for (ll i = a; i <= b; i++) #define repz(i,a,b) for (ll i = a; i < b; i++) #define repm(i,a,b) for (ll i = a; i >= b; i--) #define fr first #define sc second #define mp make_pair #define pb push_back const ll N = 5e5+5, MOD = 1e9+7; ll tc = 1, n, m, ar[N], br[N], used[10]; ll x, y, k, need; string s, s1, s2, ye = "YES", no = "NO"; vector<ll> v, ori, maxi, mini; ll ask(vector<ll> &V){ cout << "query "; for (auto i : V) cout << i << " "; cout << endl; ll bnk; cin >> bnk; return bnk; } void brt(ll idx){ if (idx > n){ ll ged = ask(v); if (ged == need){ maxi = max(maxi,v); mini = min(mini,v); } return; } repp(i,1,n){ if (used[i]) continue; used[i] = 1; v.pb(i); brt(idx+1); used[i] = 0; v.pop_back(); } } void input(){ cin >> n; repp(i,1,n){ cin >> m; ori.pb(m); } need = ask(ori); maxi = mini = ori; } void solve(){ brt(1); for (auto i : mini) cout << i << " "; cout << endl; for (auto i : maxi) cout << i << " "; cout << endl; } int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); //cin >> tc; while(tc--){ input(); solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...