#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();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
not a valid command |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
50 ms |
304 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
42 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
75 ms |
312 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |