CF1990B 题解

· · 题解

思路

终于明白为什么是 $y<x$ 而不是 $y\le x$ 了。我们只要 $a_y\sim a_x=1$,前后两端都是 $-1,1$ 交替就行辣。 # 代码 ```cpp # include <bits/stdc++.h> # define I return # define AK 0 # define IOI ; using namespace std; typedef long long ll; typedef pair <int, int> pii; int t, n, x, y; int main () { ios::sync_with_stdio (0); cin.tie (0); cout.tie (0); cin >> t; while (t --) { cin >> n >> x >> y; for (int i = y - 1; i; -- i) cout << (i & 1 ? "-1 " : "1 "); for (int i = y; i <= x; ++ i) cout << "1 "; for (int i = 1, tmp = n - x; i <= tmp; ++ i) cout << (i & 1 ? "-1 " : "1 "); cout << '\n'; } I AK IOI } ```