結果
| 問題 |
No.282 おもりと天秤(2)
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-09-20 02:18:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,116 bytes |
| コンパイル時間 | 1,136 ms |
| コンパイル使用メモリ | 99,128 KB |
| 実行使用メモリ | 25,964 KB |
| 平均クエリ数 | 264.38 |
| 最終ジャッジ日時 | 2024-07-16 06:20:54 |
| 合計ジャッジ時間 | 14,564 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 22 |
ソースコード
#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;
/////////
vector<int> hist(500);
int N,n;
void solve(){
cin >> N;
queue<PII> q;
PII temp;
for(int i=1;i<N;++i){
for(int j=i+1;j<=N;++j){
temp.first = i;
temp.second = j;
q.push( temp );
}
}
vector<bool> use(N,false);
vector<PII> IN( N );
vector<PII>::iterator it,endit;
int loop = 0;
int cnt = 0;
use = vector<bool>(N,false);
string str;
while( !q.empty() ){
temp = q.front();
q.pop();
if( !use[temp.first-1] && !use[temp.second-1] ){
IN[cnt] = temp;
++cnt;
use[temp.first-1] = true;
use[temp.second-1] = true;
}else{
q.push( temp );
}
++loop;
if( loop >= (N)*(N-1)/2 || cnt >= N/2 ){
it = IN.begin();
endit = IN.end();
cnt = 0;
cout << "?";
for( ;it != endit;++it ){
cout << " " << it->first << " " << it->second;
++cnt;
}
for(int k= cnt;k<N;++k){
cout << " 0 0";
}
cout << endl;
for(int i=0;i<cnt;++i){
cin >> str;
if( IN[i].first == 0 || IN[i].second == 0)continue;
if( str == "<" ){
++hist[ IN[i].second-1 ];
}else{
++hist[ IN[i].first-1 ];
}
}
for(int k=cnt;k<N;++k){
cin >> str;
}
/////////////
loop = 0;
cnt = 0;
use = vector<bool>(N,false);
temp.first = 0;
temp.second = 0;
IN = vector<PII>(N,temp);
}
}
vector<int> ret(N,0);
for(int i=0;i<N;++i){
ret[ hist[i] ] = i;
}
cout << "!";
for(int i=0;i<N;++i){
cout << " " << ret[i]+1;
}
cout << endl;
return ;
}
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(16);//
//cpp
solve();
return 0;
}
IL_msta