結果

問題 No.282 おもりと天秤(2)
ユーザー chocoruskchocorusk
提出日時 2019-03-31 08:09:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,304 bytes
コンパイル時間 749 ms
コンパイル使用メモリ 99,404 KB
実行使用メモリ 24,468 KB
平均クエリ数 440.42
最終ジャッジ日時 2023-09-23 16:58:36
合計ジャッジ時間 9,791 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
bool comp[501][501];
bool mycomp(int x, int y){
	return comp[x][y];
}
int main()
{
    int n; cin>>n;
	char c;
	for(int i=0; i<n; i++){
		cout<<"?";
		for(int j=0; j<n; j++){
			int l=(i-j+n)%n+1, r=(i+j)%n+1;
			if(l==r) cout<<" "<<0<<" "<<0;
			else cout<<" "<<l<<" "<<r;
		}
		cout<<endl;
		for(int j=0; j<n; j++){
			cin>>c;
			int l=(i-j+n)%n+1, r=(i+j)%n+1;
			if(l==r) continue;
			if(c=='<') comp[l][r]=1;
		}
		cout<<"?";
		for(int j=0; j<n; j++){
			int l=(i-j+n)%n+1, r=(i+j+1)%n+1;
			if(l==r) cout<<" "<<0<<" "<<0;
			else cout<<" "<<l<<" "<<r;
		}
		cout<<endl;
		for(int j=0; j<n; j++){
			cin>>c;
			int l=(i-j+n)%n+1, r=(i+j+1)%n+1;
			if(l==r) continue;
			if(c=='<') comp[l][r]=1;
		}
	}
	int a[501];
	for(int i=0; i<n; i++) a[i]=i+1;
	sort(a, a+n, mycomp);
	cout<<"!";
	for(int i=0; i<n; i++) cout<<" "<<a[i];
	cout<<endl;
    return 0;
}
0