結果

問題 No.282 おもりと天秤(2)
ユーザー IL_mstaIL_msta
提出日時 2015-09-19 18:56:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,016 bytes
コンパイル時間 2,522 ms
コンパイル使用メモリ 95,884 KB
実行使用メモリ 127,852 KB
平均クエリ数 784.04
最終ジャッジ日時 2023-09-23 06:26:47
合計ジャッジ時間 14,575 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
24,252 KB
testcase_01 AC 182 ms
23,820 KB
testcase_02 AC 56 ms
23,388 KB
testcase_03 AC 35 ms
23,568 KB
testcase_04 AC 31 ms
24,072 KB
testcase_05 AC 113 ms
23,544 KB
testcase_06 AC 233 ms
24,036 KB
testcase_07 AC 30 ms
23,712 KB
testcase_08 AC 234 ms
23,400 KB
testcase_09 AC 25 ms
23,640 KB
testcase_10 WA -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
 
#include <iostream>
#include <iomanip>
#include <sstream>
 
#include <algorithm>
#include <cmath>
 
#include <string>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>
 
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
 
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////


void solve(){
	int N;
	cin >> N;
	vector< vector<int> > v(N,vector<int>(N) );
	int h = N-1;
	vector<bool> use(N,false);
	vector<int> rank(N,0);
	int cnt = 0;
	for(int i=1;i<=h;++i){
		for(int T=0;T<=i && T+i<N;++T){
			use = vector<bool>(N,false);
			cnt = 0;
			cout << "?";
			for(int j=T;j+i<N;++j){
				if( use[j] ) continue;
				if( (j+i) < N ){
					cout << " " << j+1 << " " << (j+i)+1;
					use[j] = true;
					use[(j+i)] = true;
				}else{
					cout << " " << j+1 << " 0";
					use[j] = true;
				}
				++cnt;
			}
			for(int k=cnt;k<N;++k){
				cout << " 0 0";

			}
			cout << endl;
			use = vector<bool>(N,false);
			string str;
			for(int j=T;j+i<N;++j){
				if( use[j] ) continue;
				cin >> str;
				if( (j+i) < N ){
					if( str == "<" ){
						if( v[j][(j+i)] == v[(j+i)][j] ){
							v[j][(j+i)] = true;
							v[(j+i)][j] = false;
							++rank[(j+i)];
						}
					}else if( str == ">" ){
						if( v[j][(j+i)] == v[(j+i)][j] ){
							v[j][(j+i)] = false;
							v[(j+i)][j] = true;
							++rank[j];
						}
					}
					use[j] = true;
					use[(j+i)] = true;
				}else{
					use[j] = true;
				}
			}
			for(int k=cnt;k<N;++k){
				cin >> str;
			}
		}
	}
	vector<int> ret(N,0);
	for(int i=0;i<N;++i){
		ret[ rank[i] ] = i+1;
	}
	cout << "!";
	for(int i=0;i<N;++i){
		cout << " " << ret[i];
	}
	cout << endl;
}

int main(void){
    std::cin.tie(0); 
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed;//
    //cout << setprecision(16);//
	
	//cpp
	solve();
	return 0;
}
0