結果
問題 | No.282 おもりと天秤(2) |
ユーザー | kei |
提出日時 | 2018-10-04 23:36:55 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,868 ms / 5,000 ms |
コード長 | 2,876 bytes |
コンパイル時間 | 1,828 ms |
コンパイル使用メモリ | 177,072 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 212.58 |
最終ジャッジ日時 | 2024-07-17 01:58:36 |
合計ジャッジ時間 | 18,890 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 21 ms
24,836 KB |
testcase_01 | AC | 24 ms
25,220 KB |
testcase_02 | AC | 21 ms
25,220 KB |
testcase_03 | AC | 20 ms
24,580 KB |
testcase_04 | AC | 21 ms
24,836 KB |
testcase_05 | AC | 23 ms
24,964 KB |
testcase_06 | AC | 23 ms
25,220 KB |
testcase_07 | AC | 20 ms
24,964 KB |
testcase_08 | AC | 24 ms
24,836 KB |
testcase_09 | AC | 19 ms
24,836 KB |
testcase_10 | AC | 465 ms
25,208 KB |
testcase_11 | AC | 1,626 ms
24,836 KB |
testcase_12 | AC | 531 ms
24,964 KB |
testcase_13 | AC | 794 ms
25,476 KB |
testcase_14 | AC | 1,346 ms
25,220 KB |
testcase_15 | AC | 1,631 ms
24,964 KB |
testcase_16 | AC | 102 ms
24,836 KB |
testcase_17 | AC | 715 ms
25,220 KB |
testcase_18 | AC | 1,137 ms
24,580 KB |
testcase_19 | AC | 1,267 ms
25,220 KB |
testcase_20 | AC | 1,797 ms
24,812 KB |
testcase_21 | AC | 1,783 ms
25,196 KB |
testcase_22 | AC | 1,868 ms
24,556 KB |
testcase_23 | AC | 20 ms
24,940 KB |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; } template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; } template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; } template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; } /* <url:https://yukicoder.me/problems/no/282> 問題文============================================================ ================================================================= 解説============================================================= ================================================================ */ int main(void) { cin.tie(0); ios_base::sync_with_stdio(false); ll N; cin >> N; vector<ll> omori(N); iota(omori.begin(),omori.end(),1); bool update; for(int kassa = 0;;kassa++){ update = false; vector<pll> tenbin(N); { fill(tenbin.begin(),tenbin.end(),make_pair(0, 0)); for(int i = 0; i < N-1;i+=2) tenbin[i] = {omori[i],omori[i+1]}; cout << "?"; for(int i = 0; i < N;i++) cout << " " << tenbin[i].first << " " << tenbin[i].second; cout << endl; vector<char> rep(N); for(auto& in:rep) cin >> in; for(int i = 0; i < N;i++){ if(tenbin[i].first == 0 || tenbin[i].second == 0) continue; if(rep[i] == '>'){ swap(omori[i],omori[i+1]); update = true; } } } { fill(tenbin.begin(),tenbin.end(),make_pair(0, 0)); for(int i = 0; i < N-2;i+=2) tenbin[i] = {omori[i+1],omori[i+2]}; cout << "?"; for(int i = 0; i < N;i++) cout << " " << tenbin[i].first << " " << tenbin[i].second; cout << endl; vector<char> rep(N); for(auto& in:rep) cin >> in; for(int i = 0; i < N;i++){ if(tenbin[i].first == 0 || tenbin[i].second == 0) continue; if(rep[i] == '>'){ swap(omori[i+1],omori[i+2]); update = true; } } } if(!update) break; } cout << "! " << omori << endl; return 0; }