結果

問題 No.282 おもりと天秤(2)
ユーザー pekempeypekempey
提出日時 2015-09-18 23:45:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 938 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 144,516 KB
実行使用メモリ 36,352 KB
平均クエリ数 18699.50
最終ジャッジ日時 2023-09-23 06:03:37
合計ジャッジ時間 41,479 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a) rep2 (i, 0, a)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a) repr2 (i, 0, a)
#define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define chmin(a, b) ((b) < a && (a = (b), true))
#define chmax(a, b) (a < (b) && (a = (b), true))
#define rng(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;

int n;
int C[555][555];
int a[555];

int comp(int i, int j) {
	cout << "?";
	cout << " " << a[i] + 1 << " " << a[j] + 1;
	rep (i, n - 1) cout << " 0 0";
	cout << endl;
	char str[2];
	scanf("%s", str);
	int res;
	if (str[0] == '<') res = -1;
	else if (str[1] == '=') res = 0;
	else res = 1;
	rep (i, n - 1) scanf("%s", str);
	return res;
}

int main() {
	cin >> n;
	rep (i, n) a[i] = i;
	rep (i, n) {
		rep2 (j, i, n) {
			if (comp(a[i], a[j]) > 0) {
				swap(a[i], a[j]);
			}
		}
	}
	cout << "!";
	rep (i, n) cout << " " << a[i] << endl;
	return 0;
}
0