Submission #202872

#TimeUsernameProblemLanguageResultExecution timeMemory
202872rdd6584Sob (COCI19_sob)C++14
0 / 110
7 ms504 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...