QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#249732#7619. Make SYSU Great Again Ickiseki#WA 0ms3456kbC++201.7kb2023-11-12 14:49:432023-11-12 14:49:44

Judging History

你现在查看的是最新测评结果

  • [2023-11-12 14:49:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3456kb
  • [2023-11-12 14:49:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
void debug_(const char *s, auto ...a) {
  cerr << "\e[1;32m(" << s << ") = (";
  int f = 0;
  (..., (cerr << (f++ ? ", " : "") << a));
  cerr << ")\e[0m\n";
}
void orange_(const char *s, auto L, auto R) {
  cerr << "\e[1;33m[ " << s << " ] = [ ";
  for (int f = 0; L != R; ++f)
    cerr << (f++ ? ", " : "") << *L++;
  cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif

using lld = int64_t;

string gen_string(lld a, lld b) {
  string res;
  lld ia = 0, ib = 0;
  while (ia + ib < a + b) {
    if (ia * b <= ib * a) {
      res += '0';
      ia++;
    } else {
      res += '1';
      ib++;
    }
  }
  return res;
}

string rev(string S) {
  reverse(all(S));
  return S;
}

string f(lld, lld, string, string);
string g(lld, lld, string, string);

string f(lld a, lld b, string X, string Y) {
  const int Q = b / a;
  string B = X;
  for (int j = 0; j < Q; j++)
    B += Y;
  if (b % a == 0) {
    return B;
  }
  debug("g", b % a, a, B + Y, B);
  return g(b % a, a, B + Y, B);
}

string g(lld a, lld b, string X, string Y) {
  const int Q = b / a;
  string B;
  for (int j = 0; j < Q; j++)
    B += X;
  B += Y;

  if (b % a == 0) {
    return B;
  }
  debug("g", b % a, a, X + B, B);
  return f(b % a, a, X + B, B);
}

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);

  int A, B;
  cin >> A >> B;
  cout << gen_string(A, B) << '\n';
  cout << f(A, B, "0", "1") << '\n';
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3456kb

input:

3 6

output:

011011011
011

result:

wrong output format Expected integer, but "011011011" found