# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
202601 | 2020-02-17T09:05:19 Z | orihehe | Sob (COCI19_sob) | C++17 | 189 ms | 17528 KB |
#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); } else if(mp.find(i%t|t) != mp.end()){ ans[i] = mp[i%t | t]; mp.erase(i|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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 189 ms | 17528 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Incorrect | 5 ms | 376 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 189 ms | 17528 KB | Output is correct |
5 | Incorrect | 7 ms | 504 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |