Submission #1011409

# Submission time Handle Problem Language Result Execution time Memory
1011409 2024-06-30T13:17:10 Z vannnnnnnn Zagrade (COI20_zagrade) C++14
0 / 100
4 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]=')';
			i++;
		}
		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);
      |   ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Incorrect 4 ms 344 KB Answer length should be 1000, but it is 440
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 4. Expected ), found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -