結果

問題 No.282 おもりと天秤(2)
ユーザー climpetclimpet
提出日時 2015-09-18 23:55:45
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 695 bytes
コンパイル時間 2,070 ms
コンパイル使用メモリ 48,124 KB
実行使用メモリ 31,816 KB
平均クエリ数 117.79
最終ジャッジ日時 2023-09-23 06:05:05
合計ジャッジ時間 13,378 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
24,288 KB
testcase_01 AC 70 ms
23,628 KB
testcase_02 AC 33 ms
23,400 KB
testcase_03 AC 31 ms
23,988 KB
testcase_04 AC 28 ms
23,592 KB
testcase_05 AC 50 ms
23,868 KB
testcase_06 AC 78 ms
23,976 KB
testcase_07 AC 30 ms
23,808 KB
testcase_08 AC 85 ms
23,592 KB
testcase_09 AC 28 ms
23,604 KB
testcase_10 AC 2,454 ms
24,060 KB
testcase_11 TLE -
testcase_12 AC 2,873 ms
23,544 KB
testcase_13 WA -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 523 ms
23,640 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
using namespace std;

int n;
string rest;
char buf[3000];

int cmp(const void *p, const void *q){
	int a = *static_cast<const int*>(p);
	int b = *static_cast<const int*>(q);
	printf("? %d %d%s", a, b, rest.c_str());
	fflush(stdout);
	fgets(buf, 3000, stdin);
	if(buf[0] == '<'){ return -1; }
	if(buf[0] == '>'){ return 1; }
	return 0;
}

int main(){
	scanf("%d%*c", &n);
	for(int i = 1; i < n; ++i){
		rest += " 0 0";
	}
	rest += '\n';
	vector<int> v(n);
	for(int i = 0; i < n; ++i){
		v[i] = i + 1;
	}
	qsort(&v[0], n, sizeof(int), cmp);
	putchar('!');
	for(int i = 0; i < n; ++i){
		printf(" %d", v[i]);
	}
	puts("");
}
0