답안 #638223

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
638223 2022-09-05T02:05:00 Z iee Sob (COCI19_sob) C++17
110 / 110
86 ms 11184 KB
// iee
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>

#define rep(i, a, b) for (auto i = (a); i <= (b); ++i)
#define per(i, a, b) for (auto i = (a); i >= (b); --i)
#define fi first
#define se second
using ll = long long;
using ull = unsigned long long;
using namespace std;
void work(int);

template <class T> void read(T &x) {
  x = 0; int f = 1, ch = getchar();
  while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
  while (isdigit(ch)) x = x * 10 + (ch - '0'), ch = getchar();
  x *= f;
}

int main() {
  int TT = 1; // cin >> TT;
  rep(CAS, 1, TT)
    work(CAS);
  return 0;
}

void work(int CASE) {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> ans;
  int ns = m;
  for (int i = n - 1; i >= 0; ) {
    int k = ns;
    while (i != (k & i)) ++k;
    //cerr << i << ' ' << ns << ' ' << k << '\n';
    per(j, k, ns) ans.emplace_back(i, j), --i;
    ns = k + 1;
  }
  reverse(begin(ans), end(ans));
  for (auto it: ans)
    cout << it.fi << ' ' << it.se << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 44 ms 6032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 42 ms 6028 KB Output is correct
7 Correct 22 ms 3008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 300 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 44 ms 6032 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 304 KB Output is correct
10 Correct 42 ms 6028 KB Output is correct
11 Correct 22 ms 3008 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 300 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 9 ms 1484 KB Output is correct
20 Correct 32 ms 4536 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 48 ms 6448 KB Output is correct
24 Correct 86 ms 11184 KB Output is correct
25 Correct 83 ms 10984 KB Output is correct