結果

問題 No.282 おもりと天秤(2)
ユーザー btkbtk
提出日時 2015-09-19 00:04:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,753 bytes
コンパイル時間 1,350 ms
コンパイル使用メモリ 90,796 KB
実行使用メモリ 24,396 KB
平均クエリ数 601.00
最終ジャッジ日時 2023-09-23 06:06:16
合計ジャッジ時間 28,546 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
23,628 KB
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 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 48 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>
#include<functional>
using namespace std;


#define input_init stringstream ss; string strtoken, token; istringstream is
#define input_line  getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit)
#define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num

pair<int, int> cnt[500];
int query[600][500][2];
void sp(int d, int left, int right){
	int num = (right - left);
	int half = num / 2;
	if (half == 0)return;
	for (int i = 0; i < num - half; i++){
		for (int j = left; j < left + half; j++)
			query[d + i][j][0] = j+1;
		for (int j = 0; j < num - half; j++){
			query[d + i][(j + i) % (num - half) + left][1] = left +half+ j+1;
		}
	}
	sp(d + num - half, left, left + half);
	sp(d + num - half, left + half, right);
}
int main(void){
	int N;
	cin >> N;
	for (int i = 0; i <N; i++){
		cnt[i].first = 0; 
		cnt[i].second = i + 1;
		for (int j = 0; j < N; j++)
			query[i][j][0] = query[i][j][1] = 0;
	}
	sp(0,0, N);
	for (int i = 0; i < 600; i++){
		cout << "?";
		for (int j = 0; j < N; j++){
			cout <<" "<< query[i][j][0] << " " << query[i][j][1];
		}
		cout << endl << flush;
		for (int j = 0; j < N; j++){
			string s;
			cin >> s;
			if (s == ">")cnt[query[i][j][0]].first++;
			else if (s == "<")cnt[query[i][j][1]].first++;
		}
	}
	sort(cnt, cnt + N);
	cout << "!";
	for (int i = 0; i < N; i++){
		cout << " " << cnt[i].second;
	}
	cout << endl << flush << endl;
	return(0);
}
0