結果

問題 No.282 おもりと天秤(2)
ユーザー 👑 kmjpkmjp
提出日時 2015-09-18 23:08:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,863 ms / 5,000 ms
コード長 1,414 bytes
コンパイル時間 2,528 ms
コンパイル使用メモリ 149,360 KB
実行使用メモリ 24,420 KB
平均クエリ数 220.29
最終ジャッジ日時 2023-09-23 21:31:04
合計ジャッジ時間 20,557 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,604 KB
testcase_01 AC 30 ms
23,652 KB
testcase_02 AC 28 ms
23,424 KB
testcase_03 AC 28 ms
23,592 KB
testcase_04 AC 27 ms
23,664 KB
testcase_05 AC 30 ms
24,420 KB
testcase_06 AC 33 ms
23,868 KB
testcase_07 AC 28 ms
23,868 KB
testcase_08 AC 32 ms
23,652 KB
testcase_09 AC 27 ms
23,652 KB
testcase_10 AC 452 ms
24,036 KB
testcase_11 AC 1,639 ms
24,048 KB
testcase_12 AC 507 ms
23,652 KB
testcase_13 AC 772 ms
24,300 KB
testcase_14 AC 1,312 ms
24,300 KB
testcase_15 AC 1,662 ms
23,556 KB
testcase_16 AC 117 ms
23,868 KB
testcase_17 AC 734 ms
24,312 KB
testcase_18 AC 1,227 ms
23,460 KB
testcase_19 AC 1,214 ms
24,360 KB
testcase_20 AC 1,863 ms
24,084 KB
testcase_21 AC 1,854 ms
23,880 KB
testcase_22 AC 1,839 ms
24,024 KB
testcase_23 AC 25 ms
24,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int id[501];
char res[501][10];
pair<int,int> H[501];

void solve() {
	int i,j,k,l,r,x,y; string s;
	int ON;
	
	cin>>N;
	
	if(N==1) return _P("! 1\n");
	
	ON=N;
	if(N%2) N++;
	
	FOR(i,N) H[i].second=i+1;
	
	
	FOR(x,N-1) {
		id[N-1]=N-1;
		FOR(j,N-1) {
			if(j<N/2) id[j]=(x+j)%(N-1);
			else id[N-2-(j-N/2)]=(x+j)%(N-1);
		}
		_P("?");
		FOR(i,ON) {
			if(i<N/2) {
				if(i==N/2-1 && ON%2) _P(" 0 0");
				else _P(" %d %d",id[i]+1,id[i+N/2]+1);
			}
			else _P(" 0 0");
		}
		_P("\n");
		fflush(stdout);
		FOR(i,ON) cin>>res[i];
		
		FOR(i,N/2) {
			if(i==N/2-1 && ON%2) continue;
			if(res[i][0]=='<') H[id[i+N/2]].first++;
			if(res[i][0]=='>') H[id[i]].first++;
		}
	}
	_P("!");
	sort(H,H+ON);
	FOR(i,ON) _P(" %d",H[i].second);
	_P("\n");
	fflush(stdout);
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0