Submission #773501

# Submission time Handle Problem Language Result Execution time Memory
773501 2023-07-05T06:11:48 Z blacktulip Zagrade (COI20_zagrade) C++17
0 / 100
694 ms 856 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 

#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,a[li],k,flag,t;
int cev;
string s;
vector<int> v;
char b[li];

inline int in(){
	int x;
	cin>>x;
	return x;
}

int main(void){
	scanf("%d %d",&n,&t);
	FOR b[i]='_';
	for(int i=1;i<n;i++){
		printf("? %d %d\n",i,i+1);
		fflush(stdout);
		scanf("%d",&a[i]);
		if(a[i]==1){b[i]='(';b[i+1]=')';}
	}
	int emp=0;
	FOR{
		if(b[i]=='_'){
			emp++;
		}
	}
	int tmp=0;
	FOR{
		if(b[i]=='_' && tmp<emp/2){tmp++;b[i]='(';}
		else if(b[i]=='_') b[i]=')';
	}
	printf("! ");
	FOR printf("%c",b[i]);
	printf("\n");
	fflush(stdout);
	return 0;
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |  scanf("%d %d",&n,&t);
      |  ~~~~~^~~~~~~~~~~~~~~
zagrade.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |   scanf("%d",&a[i]);
      |   ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Incorrect 9 ms 320 KB Mismatch at position 10. Expected ), found (
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 559 ms 856 KB Output is correct
3 Incorrect 694 ms 760 KB Mismatch at position 16. Expected ), found (
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -