Submission #557137

#TimeUsernameProblemLanguageResultExecution timeMemory
557137Yazan_AlattarZagonetka (COI18_zagonetka)C++14
18 / 100
4 ms208 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define F first #define S second #define pb push_back #define endl "\n" #define all(x) x.begin(), x.end() const int M = 200007; const ll inf = 2e9; const ll mod = 1e9 + 7; const double pi = acos(-1); const double eps = 1e-6; const int dx[] = {0, -1, 0, 1}, dy[] = {1, 0, -1, 0}; const int block = 320; int n, a[M], wr1 = inf, wr2, b[M]; bool ask(){ cout << "query "; for(int i = 1; i <= n; ++i) cout << b[i] << " "; cout << endl; bool ret; cin >> ret; return ret; } int main(){ // ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; ++i) cin >> a[i]; for(int i = 1; i <= n; ++i){ for(int j = 1; j <= n; ++j){ b[j] = a[j]; if(a[j] <= a[i]) ++b[j]; } b[i] = 1; if(!ask()) wr1 = a[i]; } for(int i = 1; i <= n; ++i){ for(int j = 1; j <= n; ++j){ b[j] = a[j]; if(a[j] >= a[i]) --b[j]; } b[i] = n; if(!ask()) wr2 = a[i]; } cout << "end\n"; int emp = 0; bool ok = 0; for(int i = 1; i <= n; ++i){ if(!ok && a[i] == wr1){ emp = i; cout << i + 1 << " "; } else if(a[i] == wr2){ if(emp) cout << emp << " ", emp = -1; else cout << i << " "; ok = 1; } else cout << i + (emp > 0) << " "; } cout << endl; // cout << wr1 << " " << wr2 << endl; emp = ok = 0; for(int i = 1; i <= n; ++i){ if(!ok && a[i] == wr2){ emp = i; cout << n - i << " ";; } else if(a[i] == wr1){ if(emp) cout << n - emp + 1 << " ", emp = -1; else cout << n - i + 1 << " "; ok = 1; } else cout << n - i + 1 - (emp > 0) << " "; } cout << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...