답안 #583779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
583779 2022-06-26T07:54:55 Z eecs Zagrade (COI20_zagrade) C++17
100 / 100
948 ms 1012 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++) {
      |                     ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 9 ms 208 KB Output is correct
5 Correct 10 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 4 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 11 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 10 ms 304 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
8 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 300 ms 380 KB Output is correct
3 Correct 594 ms 380 KB Output is correct
4 Correct 884 ms 384 KB Output is correct
5 Correct 868 ms 380 KB Output is correct
6 Correct 725 ms 376 KB Output is correct
7 Correct 948 ms 784 KB Output is correct
8 Correct 833 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 645 ms 1012 KB Output is correct
3 Correct 849 ms 744 KB Output is correct
4 Correct 888 ms 752 KB Output is correct
5 Correct 656 ms 756 KB Output is correct
6 Correct 805 ms 756 KB Output is correct
7 Correct 764 ms 832 KB Output is correct
8 Correct 686 ms 376 KB Output is correct