結果

問題 No.282 おもりと天秤(2)
ユーザー どららどらら
提出日時 2015-09-18 23:46:26
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,530 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 84,516 KB
実行使用メモリ 28,280 KB
平均クエリ数 109.75
最終ジャッジ日時 2023-09-23 06:02:52
合計ジャッジ時間 10,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

string memo[505][505];

struct ST {
  int X;
};
bool operator<(const ST& a, const ST& b){
  if(memo[a.X][b.X] == "<") return true;
  if(memo[a.X][b.X] == ">") return false;
  if(memo[b.X][a.X] == ">") return true;
  if(memo[b.X][a.X] == "<") return false;
  return true;
}

int main(){
  int N;
  cin >> N;
  vector< pair<int,int> > v;
  rep(i,N){
    REP(j,i+1,N){
      v.push_back(make_pair(i+1,j+1));
    }
  }

  int idx = 0;
  while(idx < v.size()){
    cout << "?";
    int bgn = idx;
    rep(i,N){
      if(idx<v.size()){
        cout << " " << v[idx].first << " " << v[idx].second;
        idx++;
      }else{
        cout << " 0 0";
      }
    }
    cout << endl;
    string tmp;
    rep(i,N){
      cin >> tmp;
      if(tmp == "="){
        ;
      }else{
        memo[v[bgn].first][v[bgn].second] = tmp;
        bgn++;
      }
    }
  }

  vector<ST> w;
  rep(i,N){
    w.push_back((ST){i+1});
  }
  sort(ALLOF(w));
  cout << "!";
  rep(i,N){
    cout << " " << w[i].X;
  }
  cout << endl;
 
  return 0;
}
0