Submission #202603

#TimeUsernameProblemLanguageResultExecution timeMemory
202603oriheheSob (COCI19_sob)C++17
110 / 110
346 ms32632 KiB
#include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <climits> #include <unordered_set> #include <unordered_map> #include <cassert> #include <iostream> #include <string> #include <ctime> #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define pci pair<char,int> #define pdd pair<double,double> #define pli pair<ll,int> #define pil pair<int,ll> #define pdi pair<double,int> #define pdd pair<double,double> #define mod 1000000007 #define mod1 1000000009 #define mod2 1000000021 #define INF 2000000001 #define MAX 9000001 long double PI = 3.141592653589793238462643383279502884197; using namespace std; /* 🐣🐥 */ int ans[500001]; map<int, int> mp, tmp; int main() { int n, m, t = 1; scanf("%d %d", &n, &m); while (t <= n) t <<= 1; for (int i = m; i < m + n; i++) mp[i % t] = i; for (t >>= 1; ; t >>= 1) { for (int i = 0; i < n; i++) { if (ans[i]) continue; if (mp.find(i % t) != mp.end()) { ans[i] = mp[i % t]; mp.erase(i % t); } else if(mp.find(i%t|t) != mp.end()){ ans[i] = mp[i%t | t]; mp.erase(i%t |t); } } if (!t) break; tmp.clear(); for (auto iter = mp.begin(); iter != mp.end(); ++iter) { tmp[iter->first % t] = iter->second; } mp = tmp; } 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:39:7: 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...