Submission #386640

# Submission time Handle Problem Language Result Execution time Memory
386640 2021-04-07T06:42:27 Z loctildore Zagrade (COI20_zagrade) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define x first
#define y second
#define elif else if
//#define endl '\n'
#define all(x) begin(x), end(x)
int n,q;
vector<int> sk;
int arr[100069];
int temp;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin>>n>>q;
  sk.push_back(0);
  for (int i = 1; i < n; i++) {
    cout<<"? "<<*sk.rbegin()+1<<' '<<i+1<<endl;
    cin>>temp;
    if (temp) {
      arr[*sk.rbegin()]=true;
      sk.pop_back();
    }
    else{
      sk.push_back(i);
    }
  }
  for (int i = sk.size()/2; i < sk.size(); i++) {
    arr[sk[i]]=true;
  }
  for (int i = 0; i < n; i++) {
    cout<<(arr[i]?'(':')');
  }
  cout<<endl;
  return 0;
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:32:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   for (int i = sk.size()/2; i < sk.size(); i++) {
      |                             ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Incorrect query ()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Incorrect query )(
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Incorrect query (())
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Incorrect query ))((
2 Halted 0 ms 0 KB -