結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー littlegirl112
提出日時 2025-01-25 19:56:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 1,805 ms
コンパイル使用メモリ 191,476 KB
実行使用メモリ 25,984 KB
平均クエリ数 11.61
最終ジャッジ日時 2025-01-26 00:04:21
合計ジャッジ時間 5,610 ms
ジャッジサーバーID
(参考情報)
judge5 / judge12
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:12: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
    4 | bool chmin(auto &a, const auto &b) {
      |            ^~~~
main.cpp:4:27: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
    4 | bool chmin(auto &a, const auto &b) {
      |                           ^~~~
main.cpp:9:12: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
    9 | bool chmax(auto &a, const auto &b) {
      |            ^~~~
main.cpp:9:27: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
    9 | bool chmax(auto &a, const auto &b) {
      |                           ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool chmin(auto &a, const auto &b) {
    if (a <= b) return 0;
    a = b;
    return 1;
}
bool chmax(auto &a, const auto &b) {
    if (a >= b) return 0;
    a = b;
    return 1;
}
void solve();
int main() {
    cin.tie(0)->sync_with_stdio(0);
    cout << fixed << setprecision(20);
    ll t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) solve();
    return 0;
}
// ll dy[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
ll dy[] = {0, 1, 0, -1}, dx[] = {1, 0, -1, 0};
void solve() {
    ll val = 5e8;
    while (true) {
        cout << val << endl;
        ll r;
        cin >> r;
        if (r != 0) break;
        if (val % 2)
            val = (val + 1) / 2;
        else
            val /= 2;
    }
}
0