結果
| 問題 |
No.282 おもりと天秤(2)
|
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2015-09-19 00:10:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,754 bytes |
| コンパイル時間 | 860 ms |
| コンパイル使用メモリ | 90,468 KB |
| 実行使用メモリ | 25,636 KB |
| 平均クエリ数 | 2.00 |
| 最終ジャッジ日時 | 2024-07-16 06:02:44 |
| 合計ジャッジ時間 | 6,070 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:46:30: warning: iteration 500 invokes undefined behavior [-Waggressive-loop-optimizations]
46 | cnt[i].first = 0;
| ~~~~~~~~~~~~~^~~
main.cpp:45:27: note: within this loop
45 | for (int i = 0; i <600; i++){
| ~~^~~~
ソースコード
#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
#define input_init stringstream ss; string strtoken, token; istringstream is
#define input_line getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit)
#define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num
pair<int, int> cnt[500];
int query[600][500][2];
void sp(int d, int left, int right){
int num = (right - left);
int half = num / 2;
if (half == 0)return;
for (int i = 0; i < num - half; i++){
for (int j = left; j < left + half; j++)
query[d + i][j][0] = j;
for (int j = 0; j < num - half; j++){
query[d + i][(j + i) % (num - half) + left][1] = left +half+ j;
}
}
sp(d + num - half, left, left + half);
sp(d + num - half, left + half, right);
}
int main(void){
int N;
cin >> N;
for (int i = 0; i <600; i++){
cnt[i].first = 0;
cnt[i].second = i + 1;
for (int j = 0; j < N; j++)
query[i][j][0] = query[i][j][1] = -1;
}
sp(0,0, N);
for (int i = 0; i < 1; i++){
cout << "?";
for (int j = 0; j < N; j++){
cout <<" "<< query[i][j][0]+1 << " " << query[i][j][1]+1;
}
cout << endl << flush;
for (int j = 0; j < N; j++){
string s;
cin >> s;
if (s == ">")cnt[query[i][j][0]].first++;
else if (s == "<")cnt[query[i][j][1]].first++;
}
}
sort(cnt, cnt + N);
cout << "!";
for (int i = 0; i < N; i++){
cout << " " << cnt[i].second;
}
cout << endl << flush << endl;
return(0);
}
btk