Submission #386643

# Submission time Handle Problem Language Result Execution time Memory
386643 2021-04-07T06:45:49 Z loctildore Zagrade (COI20_zagrade) C++14
100 / 100
1152 ms 1428 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;
  }
  cout<<"! ";
  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 Correct 1 ms 364 KB Output is correct
2 Correct 12 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 10 ms 364 KB Output is correct
5 Correct 13 ms 364 KB Output is correct
6 Correct 10 ms 364 KB Output is correct
7 Correct 12 ms 364 KB Output is correct
8 Correct 9 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 9 ms 364 KB Output is correct
3 Correct 10 ms 364 KB Output is correct
4 Correct 13 ms 364 KB Output is correct
5 Correct 13 ms 364 KB Output is correct
6 Correct 13 ms 364 KB Output is correct
7 Correct 10 ms 364 KB Output is correct
8 Correct 12 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 555 ms 792 KB Output is correct
3 Correct 829 ms 1260 KB Output is correct
4 Correct 827 ms 1084 KB Output is correct
5 Correct 847 ms 1100 KB Output is correct
6 Correct 1004 ms 1068 KB Output is correct
7 Correct 742 ms 1428 KB Output is correct
8 Correct 1152 ms 904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1124 ms 1368 KB Output is correct
3 Correct 1114 ms 1112 KB Output is correct
4 Correct 721 ms 1348 KB Output is correct
5 Correct 764 ms 1044 KB Output is correct
6 Correct 856 ms 1060 KB Output is correct
7 Correct 902 ms 1080 KB Output is correct
8 Correct 836 ms 880 KB Output is correct