結果
| 問題 |
No.282 おもりと天秤(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-09-18 23:45:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 938 bytes |
| コンパイル時間 | 1,494 ms |
| コンパイル使用メモリ | 159,068 KB |
| 実行使用メモリ | 40,528 KB |
| 平均クエリ数 | 1579.12 |
| 最終ジャッジ日時 | 2024-07-16 05:59:34 |
| 合計ジャッジ時間 | 12,419 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 14 TLE * 2 -- * 8 |
コンパイルメッセージ
main.cpp: In function ‘int comp(int, int)’:
main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | scanf("%s", str);
| ~~~~~^~~~~~~~~~~
main.cpp:27:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | rep (i, n - 1) scanf("%s", str);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i, a) rep2 (i, 0, a)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a) repr2 (i, 0, a)
#define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define chmin(a, b) ((b) < a && (a = (b), true))
#define chmax(a, b) (a < (b) && (a = (b), true))
#define rng(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
int n;
int C[555][555];
int a[555];
int comp(int i, int j) {
cout << "?";
cout << " " << a[i] + 1 << " " << a[j] + 1;
rep (i, n - 1) cout << " 0 0";
cout << endl;
char str[2];
scanf("%s", str);
int res;
if (str[0] == '<') res = -1;
else if (str[1] == '=') res = 0;
else res = 1;
rep (i, n - 1) scanf("%s", str);
return res;
}
int main() {
cin >> n;
rep (i, n) a[i] = i;
rep (i, n) {
rep2 (j, i, n) {
if (comp(a[i], a[j]) > 0) {
swap(a[i], a[j]);
}
}
}
cout << "!";
rep (i, n) cout << " " << a[i] << endl;
return 0;
}