본문 바로가기

div34

Codeforces Round #686 (Div. 3) ABCD import sys input = sys.stdin.readline for TEST in range(int(input())): n = int(input()) for i in range(n-1): print(i+2, end=" ") print(1) A - Special Permutation 한 칸씩 옆으로 밀면 Ai != i가 성립한다. import sys input = sys.stdin.readline for TEST in range(int(input())): n = int(input()) d = {} # appearance, ind s = [*map(int, input().split())] for i, c in enumerate(s): try: d[c] = [d[c][0]+1, d[c][1]] exce.. 2020. 11. 25.
Codeforces Round #661 (Div. 3) ABC from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input())): n=int(input()) s=sorted(list(map(int,input().split()))) if len(s)==1: print("YES") else: flag=True for i in range(n): if s[i]-s[i-1]>1: flag=False if flag: print("YES") else: print("NO") A - Remove Smallest from sys import stdin def input(): return stdin.readline().rstrip() for _ in range(int(input(.. 2020. 8. 6.
Codeforces Round #656 (Div. 3) ABC #include #include using namespace std; int T, x, y, z; int a[3]; int main() { cin.tie(NULL); cout.tie(NULL); ios::sync_with_stdio(0); cin >> T; while (T--) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); if (a[1] != a[2]) { cout a[i - 1]) slope = -1; else if (a[i] < a[i - 1]) slope = 1; } else if (slope == -1) { if (a[i] < a[i - 1]) { high = i; break; } } else if (slope == 1) { if (a[i] > a[i - 1.. 2020. 8. 6.
Codeforces Round #653 (Div. 3) ABC #include using namespace std; int T, x, y, n; int main() { cin.tie(NULL); cout.tie(NULL); ios::sync_with_stdio(0); cin >> T; while (T--) { cin >> x >> y >> n; int k; if ((n / x) * x + y L; string s = ""; for (int i = 0; i < L; ++i) { char input; cin >> input; s += input; } int cnt = 0, res = 0; for (int i = 0; i < L; ++i) { if (s[i] == '(') cnt++; else { if (cnt == 0) res++; else cnt--; } } cout 2020. 8. 6.