Submission #583777

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

int main() {
    ios::sync_with_stdio(0);
    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: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++) {
      |                     ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 10 ms 208 KB Output is correct
4 Correct 7 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 11 ms 208 KB Output is correct
7 Correct 9 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 9 ms 320 KB Output is correct
3 Correct 10 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 8 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
8 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 394 ms 388 KB Output is correct
3 Correct 608 ms 400 KB Output is correct
4 Correct 838 ms 392 KB Output is correct
5 Correct 727 ms 396 KB Output is correct
6 Correct 841 ms 392 KB Output is correct
7 Correct 775 ms 1060 KB Output is correct
8 Correct 764 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 839 ms 1184 KB Output is correct
3 Correct 642 ms 624 KB Output is correct
4 Correct 731 ms 972 KB Output is correct
5 Correct 854 ms 844 KB Output is correct
6 Correct 593 ms 968 KB Output is correct
7 Correct 1004 ms 664 KB Output is correct
8 Correct 1040 ms 408 KB Output is correct