# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
600515 | penguinhacker | Sob (COCI19_sob) | C++17 | 88 ms | 9700 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> v(n);
iota(v.begin(), v.end(), m);
int offset=0;
while(__builtin_popcount(n)>1) {
int high=31-__builtin_clz(n);
vector<ar<int, 2>> p;
vector<bool> vis(1<<high);
vector<int> mp(1<<high, -1);
for (int i : v) {
int mask=i&((1<<high+1)-1);
if (mask<(1<<high)) {
cout << mask+offset << " " << i << "\n";
vis[mask]=1;
} else
mp[mask-(1<<high)]=i;
}
v.clear();
for (int i=0; i<1<<high; ++i) {
if (!vis[i]) {
assert(mp[i]!=-1);
cout << i+offset << " " << mp[i] << "\n";
} else if (mp[i]!=-1)
v.push_back(mp[i]);
}
n-=1<<high;
offset+=1<<high;
}
for (int i : v)
cout << (i&n-1)+offset << " " << i << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |