Submission #242919

# Submission time Handle Problem Language Result Execution time Memory
242919 2020-06-29T19:42:22 Z MatesV13 Zagonetka (COI18_zagonetka) C++11
9 / 100
11 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
long long n, x, starix, prvi, drugi;
vector<int> ansmin, ansmax, cur; 
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n; 
for (int i=0; i<n; i++) cin >> x;
for (int i=1; i<=n; i++) cur.push_back(i);
ansmax.resize(n, 0);
if (n<7){
	do {
	cout << "query";
	for (int i=0; i<n; i++) cout << " " << cur[i];
	cout << endl << flush; cin >> x;
	if (x){
		if (ansmin.empty()) 
			ansmin=cur;
		ansmax=cur;
	}
	} while(next_permutation(cur.begin(), cur.end()));
	cout << "end" << endl;
	for (int i=0; i<n; i++) cout << ansmin[i] << " "; cout << endl;
	for (int i=0; i<n; i++) cout << ansmax[i] << " "; cout << endl << flush;
}
else {
	cout << "query";
	for (int i=0; i<n; i++) cout << " " << cur[i];
	cout << endl << flush; cin >> starix;
	for (int i=0; i<n-1; i++) swap(cur[i], cur[i+1]);
	for (int i=1; i<=n; i++){
		cout << "query";
		for (int i=0; i<n; i++) cout << " " << cur[i];
		cout << endl << flush; cin >> x;
		if (x==0 and starix==1) prvi=i;
		if (x==1 and starix==0) drugi=i;
		starix=x; for (int i=0; i<n-1; i++) swap(cur[i], cur[i+1]);
	}
	cout << "end" << endl;
	for (int i=1; i<=n; i++){
		if (i==drugi) continue;
		else if (i==prvi) cout << prvi << " " << drugi << " ";
		else cout << i << " ";
	} cout << endl;
	for (int i=n; i>0; i--){
		if (i==prvi) continue;
		else if (i==drugi) cout << prvi << " " << drugi << " ";
		else cout << i << " ";
	} cout << endl << flush; 
}
return 0;
}

Compilation message

zagonetka.cpp: In function 'int main()':
zagonetka.cpp:24:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for (int i=0; i<n; i++) cout << ansmin[i] << " "; cout << endl;
  ^~~
zagonetka.cpp:24:52: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for (int i=0; i<n; i++) cout << ansmin[i] << " "; cout << endl;
                                                    ^~~~
zagonetka.cpp:25:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for (int i=0; i<n; i++) cout << ansmax[i] << " "; cout << endl << flush;
  ^~~
zagonetka.cpp:25:52: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for (int i=0; i<n; i++) cout << ansmax[i] << " "; cout << endl << flush;
                                                    ^~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 11 ms 384 KB Output is correct
6 Correct 11 ms 384 KB Output is correct
7 Correct 11 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -