답안 #563733

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
563733 2022-05-18T04:17:15 Z Devigo Zagonetka (COI18_zagonetka) C++14
0 / 100
51 ms 300 KB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back;
#define mp make_pair;

const int siz = 0;
const int mod = 0;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> v(n);
	for(int i=0; i<n; i++) {
		cin >> v[i];
	}
	vector<int> sml = v;
	vector<int> lar = v;
	for(int i=0; i<n; i++) {
		int indi = -1, indj = -1, small = sml[i];
		for(int j=i+1; j<n; j++) {
			cout << "query";
			for(int k=0; k<n; k++) {
				if(k == i) {
					cout << " " << sml[j];
				}
				else if(k == j) {
					cout << " " << sml[i];
				}
				else {
					cout << " " << sml[k];
				}
			}
			cout << endl;
			int x; cin >> x;
			if(x == 1) {
				if(sml[j] < small) {
					small = sml[j];
					indj = j; indi = i;
				}
			}
		}
		if(indi != -1) {
			swap(sml[indi],sml[indj]);
		}
	}
	for(int i=0; i<n; i++) {
		int indi = -1, indj = -1, small = lar[i];
		for(int j=i+1; j<n; j++) {
			cout << "query";
			for(int k=0; k<n; k++) {
				if(k == i) {
					cout << " " << lar[j];
				}
				else if(k == j) {
					cout << " " << lar[i];
				}
				else {
					cout << " " << lar[k];
				}
			}
			cout << endl;
			int x; cin >> x;
			if(x == 1) {
				if(lar[j] > small) {
					small = lar[j];
					indj = j; indi = i;
				}
			}
		}
		if(indi != -1) {
			swap(lar[indi],lar[indj]);
		}
	}
	cout << "end" << endl;
	for(int i=0; i<n; i++) {
		cout << sml[i] << " ";
	}
	cout << endl;
	for(int i=0; i<n; i++) {
		cout << lar[i] << " ";
	}
	cout << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 51 ms 300 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -