답안 #1011411

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011411 2024-06-30T13:18:01 Z vannnnnnnn Zagrade (COI20_zagrade) C++14
0 / 100
561 ms 344 KB
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n, q;
	scanf("%d %d", &n, &q);
	char s[n+5];
	s[0]='(';
	for(int i=0; i<n-1; i++)
	{
		printf("? %d %d\n", i+1, i+2);
		fflush(stdout);
		int ans;
		scanf("%d", &ans);
		if(ans==1)
		{
			s[i]='(';
			s[i+1]=')';
		}
		else
		{
			if(s[i]=='(')
			{
				s[i+1]='(';
			}
			else
			{
				s[i+1]=')';
			}
		}
	}
	printf("! ");
	for(int i=0; i<n; i++)
	{
		printf("%c", s[i]);
	}
	printf("\n");
	fflush(stdout);
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%d %d", &n, &q);
      |  ~~~~~^~~~~~~~~~~~~~~~~
zagrade.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &ans);
      |   ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Incorrect 4 ms 344 KB Mismatch at position 12. Expected (, found )
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 504 ms 344 KB Output is correct
3 Incorrect 561 ms 344 KB Mismatch at position 19. Expected (, found )
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -