Submission #539494

# Submission time Handle Problem Language Result Execution time Memory
539494 2022-03-19T03:58:05 Z hhhhaura Zagrade (COI20_zagrade) C++14
14 / 100
1346 ms 684 KB
#define wiwihorz
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define ceil(a, b) ((a + b - 1) / (b))
#define all(x) x.begin(), x.end()
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)
using namespace std;
#ifdef wiwihorz
#define print(a...)cerr<<"Line "<<__LINE__<<":",kout("["+string(#a)+"] = ", a)
void vprint(auto L,auto R){while(L<R)cerr<<*L<<" \n"[next(L)==R], ++L;}
void kout(){cerr<< endl;}
template<class T1,class ... T2>void kout(T1 a,T2 ... e){cerr<<a<<" ",kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif

signed main() {
	int n, q;
	cin >> n >> q;
	vector<int> a(n + 1, 0);
	auto query = [&](int L, int R) {
		cout << "? " << L << " " << R << "\n";
		cout.flush();
		int x; cin >> x;
		return x;
	};
	auto report = [&]() {
		cout << "! ";
		rep(i, 1, n) cout << (a[i] ? ")" : "(");
		cout << "\n";
		cout.flush();
	};
	a[n] = 1;
	rep(i, 2, n - 1) {
		int yes = 0;
		for(int j = 1; j <= i - 1; j += 2) {
			int x = query(i - j, i);
			if(x) {
				yes = 1;
				break;
			}
		}
		a[i] = yes;
	}
	report();
	return 0;
}


Compilation message

zagrade.cpp:16:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   16 | void vprint(auto L,auto R){while(L<R)cerr<<*L<<" \n"[next(L)==R], ++L;}
      |             ^~~~
zagrade.cpp:16:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   16 | void vprint(auto L,auto R){while(L<R)cerr<<*L<<" \n"[next(L)==R], ++L;}
      |                    ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 788 ms 208 KB Output is correct
3 Correct 942 ms 292 KB Output is correct
4 Correct 1002 ms 208 KB Output is correct
5 Correct 822 ms 208 KB Output is correct
6 Correct 722 ms 208 KB Output is correct
7 Correct 1346 ms 208 KB Output is correct
8 Correct 672 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 Runtime error 589 ms 684 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -