๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.61K subscribers
5.61K photos
3 videos
95 files
10.6K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        long long x, y;
        cin >> x >> y;
        if (y > x) {
            cout << 2 << '\n';
        } else if (y >= 2 && x - y >= 2) {
            cout << 3 << '\n';
        } else {
            cout << -1 << '\n';
        }
    }
    return 0;
}

CODEFORCES A
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    if(!(cin >> t)) return 0;
    while (t--) {
        int n;
        cin >> n;
        int m = 2 * n;
        vector<int> a(m + 1, 0);
        vector<char> used(m + 1, 0);
        int cur = 1;
        for (int x = n; x >= 1; --x) {
            while (used[cur]) ++cur;
            int i = cur;
            int j = i + x;
            while (j <= m && used[j]) j += x;
            a[i] = a[j] = x;
            used[i] = used[j] = 1;
        }
        for (int i = 1; i <= m; ++i) {
            if (i > 1) cout << ' ';
            cout << a[i];
        }
        cout << '\n';
    }
    return 0;
}

B