結果

問題 No.282 おもりと天秤(2)
ユーザー mamekin
提出日時 2016-02-06 01:41:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,220 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 92,960 KB
実行使用メモリ 32,688 KB
平均クエリ数 917.12
最終ジャッジ日時 2024-07-16 22:54:19
合計ジャッジ時間 17,017 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        a[i] = i + 1;

    for(int t=0; t<2000; ++t){
        cout << '?';
        for(int i=0; i<n; ++i)
            cout << ' ' << a[(i+t%2)%n];
        for(int i=0; i<n; ++i)
            cout << ' ' << 0;
        cout << endl;

        string c(n, ' ');
        for(int i=0; i<n; ++i)
            cin >> c[i];

        if(t % 2 == 0){
            for(int i=0; i<n/2; ++i){
                if(c[i] == '>')
                    swap(a[2*i], a[2*i+1]);
            }
        }
        else{
            for(int i=0; i<(n-1)/2; ++i){
                if(c[i] == '>')
                    swap(a[2*i+1], a[2*i+2]);
            }
        }
    }

    cout << '!';
    for(int i=0; i<n; ++i)
        cout << ' ' << a[i];
    cout << endl;

    return 0;
}
0