Submission #202872

# Submission time Handle Problem Language Result Execution time Memory
202872 2020-02-18T13:44:58 Z rdd6584 Sob (COCI19_sob) C++14
0 / 110
7 ms 504 KB
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int>> pq;

unordered_map<int, int> um;
char visit[1000001];
char ans[1000001];

int main() {
    int n, m;
    scanf("%d %d", &n, &m);

    for (int i = 20; i >= 0; i--) {
        um.clear();
        int mask = (1 << i) - 1;

        for (int j = m; j < n + m; j++)
            if (!visit[j]) um[j & mask] = j;

        for (int j = 0; j < n; j++)
            if (!visit[j] && um.find(j & mask) != um.end()) {
                ans[j] = um[j & mask];
                visit[um[j & mask]] = 1;
                visit[j] = 1;
                um.erase(j & mask);
            }
    }

    for (int i = 0; i < n; i++)
        printf("%d %d\n", i, ans[i]);
}

Compilation message

sob.cpp: In function 'int main()':
sob.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer parameter [name=y] equals to 0, violates the range [724385, 724512]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 504 KB Integer parameter [name=y] equals to -1, violates the range [4815, 8191]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer parameter [name=y] equals to -68, violates the range [178, 189]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer parameter [name=y] equals to 0, violates the range [724385, 724512]
2 Halted 0 ms 0 KB -