답안 #780817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
780817 2023-07-12T13:33:19 Z andecaandeci Zagrade (COI20_zagrade) C++17
0 / 100
0 ms 208 KB
#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL jawab;
void tanya(LL x,LL y)
{
  cout<<"? "<<x<<" "<<y<<endl;
  cin>>jawab;
}
int main()
{
  LL n,q;
  scanf("%lld %lld",&n,&q);
  vector<LL>v;
  char arr[n+5];
  for(LL a=1;a<=n;a++)
  {
    arr[a]='*';
  }
  LL buka=0,tutup=0;
  for(LL a=1;a<=n;a++)
  {
    if(v.size()==0)
    {
      v.push_back(a);
      continue;  
    }
    tanya(v[v.size()-1],a);
    if(!jawab)
    {
      v.push_back(a);
    }
    else
    {
      arr[v[v.size()-1]]='(';
      arr[a]=')';
      tutup++;
      v.pop_back();
    }
  }
  LL bagi=n/2;
  for(LL a=1;a<=n;a++)
  {
  //  printf("%lld %lld %lld\n",buka,tutup,bagi);
    if(arr[a]=='*')
    {
      if(tutup<bagi)
      {
        arr[a]=')';
        tutup++;
      }
      else arr[a]='(';
    }
  }
  cout<<"! ";
  for(LL a=1;a<=n;a++)cout<<arr[a]<<" ";
  cout<<endl;
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:20:6: warning: unused variable 'buka' [-Wunused-variable]
   20 |   LL buka=0,tutup=0;
      |      ^~~~
zagrade.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%lld %lld",&n,&q);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Answer length should be 2, but it is 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Answer length should be 2, but it is 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Answer length should be 4, but it is 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Answer length should be 4, but it is 1
2 Halted 0 ms 0 KB -