Submission #583775

# Submission time Handle Problem Language Result Execution time Memory
583775 2022-06-26T07:53:09 Z eecs Zagrade (COI20_zagrade) C++17
100 / 100
807 ms 1080 KB
#include <bits/stdc++.h>
using namespace std;

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

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int i = 0; i < st.size() / 2; i++) {
      |                     ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 9 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 9 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
8 Correct 9 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 10 ms 284 KB Output is correct
3 Correct 10 ms 296 KB Output is correct
4 Correct 11 ms 296 KB Output is correct
5 Correct 10 ms 208 KB Output is correct
6 Correct 10 ms 208 KB Output is correct
7 Correct 8 ms 208 KB Output is correct
8 Correct 9 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 382 ms 376 KB Output is correct
3 Correct 772 ms 372 KB Output is correct
4 Correct 565 ms 380 KB Output is correct
5 Correct 684 ms 380 KB Output is correct
6 Correct 807 ms 388 KB Output is correct
7 Correct 546 ms 800 KB Output is correct
8 Correct 726 ms 396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 558 ms 956 KB Output is correct
3 Correct 643 ms 680 KB Output is correct
4 Correct 739 ms 856 KB Output is correct
5 Correct 667 ms 744 KB Output is correct
6 Correct 696 ms 1080 KB Output is correct
7 Correct 642 ms 632 KB Output is correct
8 Correct 524 ms 380 KB Output is correct