Submission #583774

# Submission time Handle Problem Language Result Execution time Memory
583774 2022-06-26T07:51:27 Z eecs Zagrade (COI20_zagrade) C++17
0 / 100
0 ms 208 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n >> *new int;
    auto ask = [&](int a, int b) {
        cout << "? " << a << " " << b << endl;
        return cin >> a, a;
    };
    vector<int> st;
    vector<char> res(n + 1);
    for (int i = 1; i <= n; i++) {
        if (st.empty() || !ask(st.back(), i)) st.push_back(i);
        else res[st.back()] = '(', res[i] = ')', st.pop_back();
    }
    for (int i = 0; i < st.size() / 2; i++) {
        res[st[i]] = ')';
    }
    for (int i = st.size() / 2; i < st.size(); i++) {
        res[st[i]] = '(';
    }
    cout << "!";
    for (int i = 1; i <= n; i++) {
        cout << " " << res[i];
    }
    cout << endl;
    return 0;
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (int i = 0; i < st.size() / 2; i++) {
      |                     ~~^~~~~~~~~~~~~~~
zagrade.cpp:21:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = st.size() / 2; i < st.size(); i++) {
      |                                 ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 2, but it is 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 2, but it is 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 4, but it is 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 4, but it is 1
2 Halted 0 ms 0 KB -