Почему мне пишет, что решение зависло?
Difference between ru1 and ru2, changed 2 character(s)
Вот мой код. Даже ускорение cin7.tie(0); убрал↵
#include <iostream>↵
using namespace std;↵
↵
int main()↵
{↵
    ios_base::sync_with_stdio(false);↵
    int t;↵
    cin >> t;↵
    for (int h = 0; h < t; h++){↵
        int n; cin >> n;↵
        if (n > 2){↵
          for (int i = 4; i < 2 * n; i += 2){↵
              cout << '?' << " " << i + 1 << " " << i + 2 << endl;↵
              int k; cin >> k;↵
              if (k == 1)↵
                  cout << '!' << " " << i + 1;↵
              cout.flush();↵
          }↵
        }↵
        int a, b, c;↵
        cout << '?' << " " << 1 << " " << 2 << endl;↵
        cin >> a;↵
        cout.flush();↵
        cout << '?' << " " << 1 << " " << 3 << endl;↵
        cin >> b;↵
        cout.flush();↵
        cout << '?' << " " << 2 << " " << 3 << endl;↵
        cin >> c;↵
        cout.flush();↵
        if (a == 1 || b == 1)↵
            cout << '!' << " " << 1;↵
        else if (c == 1)↵
            cout << '!' << " " << 2;↵
        else ↵
            cout << '!' << " " << 4;↵
    }↵
    return 0;↵
}↵
Что не так?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru2 Russian PashaPupsik 2026-10-17 10:50:15 2 Мелкая правка: 'орение cin7tie(0); уб' -> 'орение cin.tie(0); уб'
ru1 Russian PashaPupsik 2026-03-21 19:22:36 1099 Первая редакция (опубликовано)