結果
問題 | No.282 おもりと天秤(2) |
ユーザー |
![]() |
提出日時 | 2018-10-27 19:14:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,948 bytes |
コンパイル時間 | 2,069 ms |
コンパイル使用メモリ | 208,072 KB |
最終ジャッジ日時 | 2025-01-06 14:52:53 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 22 |
ソースコード
#include <bits/stdc++.h>using namespace std;using i64 = int64_t;using vi = vector<i64>;using vvi = vector<vi>;int main() {int n;cin >> n;vvi res(n, vi(n));int N = n;list<int> ord;for (int i = 1; i < n / 2 * 2; i++) {ord.push_back(i);}if (n % 2) {ord.push_back(-1);n++;}for (int i = 0; i < n / 2 - 1; i++) {vvi match(n / 2, vi(2));match[0][0] = 0;int j = 1;for (int k: ord) {if (j < n / 2) {match[j][0] = j;} else {match[j - n / 2][1] = j;}j++;}cout << "?";for (int i = 0; i < n / 2; i++) {if (match[i][0] == -1 || match[i][1] == -1) {cout << " 0 0";} else {cout << " " << match[i][0] + 1 << " " << match[i][1] + 1;}}for (int i = 0; i < N - n / 2; i++) {cout << " 0 0";}cout << endl;char ch;for (int i = 0; i < n / 2; i++) {cin >> ch;if (match[i][0] == -1 || match[i][1] == -1) {assert(ch == '=');} else {assert(ch != '=');if (ch == '>') {res[match[i][0]][match[i][1]] = 1;} else {res[match[i][1]][match[i][0]] = 1;}}}for (int i = 0; i < N - n / 2; i++) {cin >> ch;}ord.push_back(ord.front());ord.pop_front();}using ii = pair<int, int>;vector<ii> cnt;for (int i = 0; i < N; i++) {cnt.push_back(ii(accumulate(res[i].begin(), res[i].end(), 0), i));}sort(cnt.begin(), cnt.end());cout << "!";for (int i = 0; i < N; i++) {cout << " " << cnt[i].second + 1;}cout << endl;}