QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106377#6412. Classical Geometry ProblemmaspyAC ✓51ms3872kbC++2315.7kb2023-05-17 15:43:452023-05-17 15:43:46

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-17 15:43:46]
  • 评测
  • 测评结果:AC
  • 用时:51ms
  • 内存:3872kb
  • [2023-05-17 15:43:45]
  • 提交

answer

#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#define vv(type, name, h, ...) \
  vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...)   \
  vector<vector<vector<type>>> name( \
      h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)       \
  vector<vector<vector<vector<type>>>> name( \
      a, vector<vector<vector<type>>>(       \
             b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))

// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)

#define FOR_subset(t, s) \
  for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T, typename U>
T ceil(T x, U y) {
  return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
  return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <typename T, typename U>
T SUM(const vector<U> &A) {
  T sum = 0;
  for (auto &&a: A) sum += a;
  return sum;
}

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
  sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  assert(!que.empty());
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  assert(!que.empty());
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
  }
  return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
  FOR(iter) {
    double x = (ok + ng) / 2;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
  }
  return (ok + ng) / 2;
}

template <class T, class S>
inline bool chmax(T &a, const S &b) {
  return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
  return (a > b ? a = b, 1 : 0);
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
  int N = A.size();
  vector<T> B(N + 1);
  FOR(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
  vector<int> ids(len(A));
  iota(all(ids), 0);
  sort(all(ids),
       [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}
#endif
#line 1 "library/other/io.hpp"
// based on yosupo's fastio
#include <unistd.h>

namespace fastio {
#define FASTIO
// クラスが read(), print() を持っているかを判定するメタ関数
struct has_write_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.write(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_write : public decltype(has_write_impl::check<T>(std::declval<T>())) {
};

struct has_read_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.read(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_read : public decltype(has_read_impl::check<T>(std::declval<T>())) {};

struct Scanner {
  FILE *fp;
  char line[(1 << 15) + 1];
  size_t st = 0, ed = 0;
  void reread() {
    memmove(line, line + st, ed - st);
    ed -= st;
    st = 0;
    ed += fread(line + ed, 1, (1 << 15) - ed, fp);
    line[ed] = '\0';
  }
  bool succ() {
    while (true) {
      if (st == ed) {
        reread();
        if (st == ed) return false;
      }
      while (st != ed && isspace(line[st])) st++;
      if (st != ed) break;
    }
    if (ed - st <= 50) {
      bool sep = false;
      for (size_t i = st; i < ed; i++) {
        if (isspace(line[i])) {
          sep = true;
          break;
        }
      }
      if (!sep) reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    while (true) {
      size_t sz = 0;
      while (st + sz < ed && !isspace(line[st + sz])) sz++;
      ref.append(line + st, sz);
      st += sz;
      if (!sz || st != ed) break;
      reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    bool neg = false;
    if (line[st] == '-') {
      neg = true;
      st++;
    }
    ref = T(0);
    while (isdigit(line[st])) { ref = 10 * ref + (line[st++] & 0xf); }
    if (neg) ref = -ref;
    return true;
  }
  template <typename T,
            typename enable_if<has_read<T>::value>::type * = nullptr>
  inline bool read_single(T &x) {
    x.read();
    return true;
  }
  bool read_single(double &ref) {
    string s;
    if (!read_single(s)) return false;
    ref = std::stod(s);
    return true;
  }
  bool read_single(char &ref) {
    string s;
    if (!read_single(s) || s.size() != 1) return false;
    ref = s[0];
    return true;
  }
  template <class T>
  bool read_single(vector<T> &ref) {
    for (auto &d: ref) {
      if (!read_single(d)) return false;
    }
    return true;
  }
  template <class T, class U>
  bool read_single(pair<T, U> &p) {
    return (read_single(p.first) && read_single(p.second));
  }
  template <size_t N = 0, typename T>
  void read_single_tuple(T &t) {
    if constexpr (N < std::tuple_size<T>::value) {
      auto &x = std::get<N>(t);
      read_single(x);
      read_single_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool read_single(tuple<T...> &tpl) {
    read_single_tuple(tpl);
    return true;
  }
  void read() {}
  template <class H, class... T>
  void read(H &h, T &... t) {
    bool f = read_single(h);
    assert(f);
    read(t...);
  }
  Scanner(FILE *fp) : fp(fp) {}
};

struct Printer {
  Printer(FILE *_fp) : fp(_fp) {}
  ~Printer() { flush(); }

  static constexpr size_t SIZE = 1 << 15;
  FILE *fp;
  char line[SIZE], small[50];
  size_t pos = 0;
  void flush() {
    fwrite(line, 1, pos, fp);
    pos = 0;
  }
  void write(const char val) {
    if (pos == SIZE) flush();
    line[pos++] = val;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  void write(T val) {
    if (pos > (1 << 15) - 50) flush();
    if (val == 0) {
      write('0');
      return;
    }
    if (val < 0) {
      write('-');
      val = -val; // todo min
    }
    size_t len = 0;
    while (val) {
      small[len++] = char(0x30 | (val % 10));
      val /= 10;
    }
    for (size_t i = 0; i < len; i++) { line[pos + i] = small[len - 1 - i]; }
    pos += len;
  }
  void write(const string s) {
    for (char c: s) write(c);
  }
  void write(const char *s) {
    size_t len = strlen(s);
    for (size_t i = 0; i < len; i++) write(s[i]);
  }
  void write(const double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  void write(const long double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  template <typename T,
            typename enable_if<has_write<T>::value>::type * = nullptr>
  inline void write(T x) {
    x.write();
  }
  template <class T>
  void write(const vector<T> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  template <class T, class U>
  void write(const pair<T, U> val) {
    write(val.first);
    write(' ');
    write(val.second);
  }
  template <size_t N = 0, typename T>
  void write_tuple(const T t) {
    if constexpr (N < std::tuple_size<T>::value) {
      if constexpr (N > 0) { write(' '); }
      const auto x = std::get<N>(t);
      write(x);
      write_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool write(tuple<T...> tpl) {
    write_tuple(tpl);
    return true;
  }
  template <class T, size_t S>
  void write(const array<T, S> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  void write(i128 val) {
    string s;
    bool negative = 0;
    if (val < 0) {
      negative = 1;
      val = -val;
    }
    while (val) {
      s += '0' + int(val % 10);
      val /= 10;
    }
    if (negative) s += "-";
    reverse(all(s));
    if (len(s) == 0) s = "0";
    write(s);
  }
};
Scanner scanner = Scanner(stdin);
Printer printer = Printer(stdout);
void flush() { printer.flush(); }
void print() { printer.write('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  printer.write(head);
  if (sizeof...(Tail)) printer.write(' ');
  print(forward<Tail>(tail)...);
}

void read() {}
template <class Head, class... Tail>
void read(Head &head, Tail &... tail) {
  scanner.read(head);
  read(tail...);
}
} // namespace fastio
using fastio::print;
using fastio::flush;
using fastio::read;

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define STR(...)      \
  string __VA_ARGS__; \
  read(__VA_ARGS__)
#define CHAR(...)   \
  char __VA_ARGS__; \
  read(__VA_ARGS__)
#define DBL(...)      \
  double __VA_ARGS__; \
  read(__VA_ARGS__)

#define VEC(type, name, size) \
  vector<type> name(size);    \
  read(name)
#define VV(type, name, h, w)                     \
  vector<vector<type>> name(h, vector<type>(w)); \
  read(name)

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"

using Re = double;
using T = tuple<Re, Re, Re, Re>;
const int B = 255;

void simu(vc<T> dat) {
  Re x = 0, y = 0, z = 0;
  for (auto&& [x1, y1, z1, d]: dat) {
    Re dx = x1 - x, dy = y1 - y, dz = z1 - z;
    Re norm = sqrt(dx * dx + dy * dy + dz * dz);
    Re t = d / norm;
    x += t * dx;
    y += t * dy;
    z += t * dz;
  }
  print(x, y, z);
}

Re dist(Re x, Re y, Re z, Re x1, Re y1, Re z1) {
  Re dx = x - x1, dy = y - y1, dz = z - z1;
  return sqrt(dx * dx + dy * dy + dz * dz);
}

void solve() {
  Re x, y, z;
  read(x), read(y), read(z);
  x /= B, y /= B, z /= B;

  auto dfs = [&](auto& dfs, Re x, Re y, Re z) -> vc<T> {
    if (x > y) {
      auto dat = dfs(dfs, y, x, z);
      for (auto&& [a, b, c, d]: dat) swap(a, b);
      return dat;
    }
    if (y > z) {
      auto dat = dfs(dfs, x, z, y);
      for (auto&& [a, b, c, d]: dat) swap(b, c);
      return dat;
    }
    assert(x <= y && y <= z);
    // to x=0
    if (x > 0) {
      Re t = x;
      Re x1 = 1.0 - (1.0 - x) / (1.0 - t);
      Re y1 = 1.0 - (1.0 - y) / (1.0 - t);
      Re z1 = 1.0 - (1.0 - z) / (1.0 - t);
      if (t == 1.0) x1 = 0.0, y1 = 0.0, z1 = 0.0;
      Re d = dist(x, y, z, x1, y1, z1);
      auto dat = dfs(dfs, x1, y1, z1);
      dat.eb(1, 1, 1, d);
      return dat;
    }
    if (y > 0) {
      Re t = y;
      Re x1 = 0.0;
      Re y1 = 1.0 - (1.0 - y) / (1.0 - t);
      Re z1 = 1.0 - (1.0 - z) / (1.0 - t);
      if (t == 1.0) x1 = 0.0, y1 = 0.0, z1 = 0.0;
      Re d = dist(x, y, z, x1, y1, z1);
      auto dat = dfs(dfs, x1, y1, z1);
      dat.eb(0, 1, 1, d);
      return dat;
    }
    if (z > 0) {
      Re t = z;
      Re x1 = 0.0;
      Re y1 = 0.0;
      Re z1 = 0.0;
      if (t == 1.0) x1 = 0.0, y1 = 0.0, z1 = 0.0;
      Re d = dist(x, y, z, x1, y1, z1);
      auto dat = dfs(dfs, x1, y1, z1);
      dat.eb(0, 0, 1, d);
      return dat;
    }
    return {};
  };

  auto dat = dfs(dfs, x, y, z);
  for (auto&& [a, b, c, d]: dat) {
    a = int(B * a + 0.5);
    b = int(B * b + 0.5);
    c = int(B * c + 0.5);
    d *= B;
  }

  // simu(dat);
  print(len(dat));
  for (auto&& [a, b, c, d]: dat) print(int(a), int(b), int(c), d);
}

signed main() {
  INT(T);
  FOR(T) solve();
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3568kb

input:

3
105 255 175
174 174 174
0 0 0

output:

3
0 255 0 255.000000000000000
0 255 255 119.000000000000000
255 255 255 119.000000000000000
1
255 255 255 301.376840516984601
0

result:

ok ok (3 test cases)

Test #2:

score: 0
Accepted
time: 44ms
memory: 3632kb

input:

10000
250 128 13
1 245 2
88 183 138
179 69 194
153 246 33
255 119 192
233 30 108
26 208 33
53 162 189
225 130 10
202 137 121
152 198 25
49 165 180
228 56 30
74 18 14
6 115 31
168 242 206
90 238 139
44 103 60
16 21 190
229 209 68
41 171 181
39 74 73
181 96 18
234 95 70
75 174 84
101 16 44
202 249 80
...

output:

3
255 0 0 244.960629921259823
255 255 0 121.271562481707207
255 255 255 14.683872523534538
3
0 255 0 244.920948616600811
0 255 255 1.004720917329022
255 255 255 1.411981404758213
3
0 255 0 98.076923076923094
0 255 255 89.645464491727452
255 255 255 113.949582887386640
3
0 0 255 50.328947368421069
25...

result:

ok ok (10000 test cases)

Test #3:

score: 0
Accepted
time: 50ms
memory: 3812kb

input:

10000
90 173 87
39 251 59
39 43 150
106 29 130
52 55 180
236 225 70
171 15 48
92 133 240
182 226 10
126 139 105
196 7 204
32 131 193
27 96 218
67 29 33
159 9 251
130 111 243
226 69 39
198 131 80
108 169 147
45 36 170
76 138 251
55 235 186
224 165 48
51 133 173
225 14 226
234 70 139
178 92 174
138 24...

output:

4
0 255 0 128.272727272727309
255 255 0 5.084891638574913
255 255 255 0.000000000000069
255 255 255 129.125162988616324
3
0 255 0 249.795918367346900
0 255 255 23.616027532010040
255 255 255 52.667780110124191
3
0 0 255 128.702830188679201
0 255 255 5.269681089668931
255 255 255 57.841219509815964
3...

result:

ok ok (10000 test cases)

Test #4:

score: 0
Accepted
time: 44ms
memory: 3664kb

input:

10000
186 217 161
76 0 116
246 159 161
32 245 65
206 120 71
217 76 204
109 255 245
157 59 192
55 35 87
27 147 199
190 134 31
169 64 105
5 27 255
161 2 35
244 255 232
253 106 199
28 151 129
50 24 20
172 236 234
74 51 150
179 68 178
69 42 192
152 1 23
177 169 71
216 190 125
136 223 193
255 168 49
74 2...

output:

4
0 255 0 114.565217391304316
255 255 0 77.423738456576189
255 255 255 0.000000000000049
255 255 255 210.056622440366709
2
0 0 255 56.983240223463653
255 0 255 96.223583047615705
3
255 0 0 230.585106382978722
255 0 255 5.336794410424321
255 255 255 223.028684131240198
3
0 255 0 241.578947368421041
0...

result:

ok ok (10000 test cases)

Test #5:

score: 0
Accepted
time: 47ms
memory: 3832kb

input:

10000
26 6 234
114 6 172
198 19 173
214 204 1
104 186 218
199 182 82
47 240 186
223 240 143
184 99 164
184 155 37
185 4 114
49 253 17
239 214 37
0 231 38
73 245 212
121 102 155
86 234 219
157 173 216
236 46 65
103 67 130
27 253 105
83 105 197
81 93 254
47 206 225
207 110 24
38 119 248
76 243 180
10 ...

output:

3
0 0 255 231.615720524017433
255 0 255 20.567868290690644
255 255 255 8.167324052251226
3
0 0 255 104.893617021276640
255 0 255 128.342253846606383
255 255 255 7.179388571751028
3
255 0 0 77.743902439024339
255 0 255 202.650628704120351
255 255 255 20.631072226015274
3
255 0 0 50.000000000000050
25...

result:

ok ok (10000 test cases)

Test #6:

score: 0
Accepted
time: 47ms
memory: 3628kb

input:

10000
122 50 52
152 12 229
149 135 184
140 164 193
2 251 109
180 33 217
241 225 126
33 165 94
57 163 242
85 164 132
179 131 197
185 186 185
216 145 74
95 203 40
158 236 193
245 97 111
144 61 52
9 67 157
44 113 152
132 82 110
130 182 33
96 168 202
10 184 228
173 243 124
198 29 180
196 15 47
153 63 54...

output:

3
255 0 0 87.931034482758633
255 0 255 2.974202613932169
255 255 255 77.483854893680984
4
0 0 255 190.631067961165087
255 0 255 151.521932102263975
255 255 255 0.000000000000040
255 255 255 13.096571883214734
3
0 0 255 84.198113207547152
255 0 255 35.807028880364143
255 255 255 197.042071966877188
4...

result:

ok ok (10000 test cases)

Test #7:

score: 0
Accepted
time: 47ms
memory: 3600kb

input:

10000
218 94 126
189 17 30
100 251 196
67 123 128
157 60 0
161 139 95
179 210 67
98 91 45
186 227 63
242 172 226
173 1 24
66 118 98
194 75 112
189 176 43
243 226 174
112 93 67
202 143 142
117 216 97
108 179 239
161 97 91
233 111 216
110 231 208
195 20 203
43 24 22
189 205 79
98 167 102
230 139 185
1...

output:

3
255 0 0 181.860465116279045
255 0 255 52.726801714272518
255 255 255 122.373539650802002
3
255 0 0 180.200000000000017
255 0 255 14.515445679182790
255 255 255 23.864519817554442
3
0 255 0 237.711864406779625
0 255 255 158.298033521918967
255 255 255 107.030683066052831
4
0 0 255 9.659090909090844...

result:

ok ok (10000 test cases)

Test #8:

score: 0
Accepted
time: 46ms
memory: 3668kb

input:

10000
58 139 199
227 23 87
52 111 207
249 83 64
55 125 147
142 246 229
118 194 7
164 16 252
59 36 140
143 180 64
167 127 108
202 51 10
172 6 150
28 149 45
72 217 154
236 88 23
4 226 232
225 109 37
172 245 69
190 112 71
81 40 143
124 38 213
124 112 178
169 61 176
180 125 234
1 63 157
51 215 59
75 216...

output:

3
0 0 255 131.896551724137964
0 255 255 116.426100961071512
255 255 255 69.297979045319352
3
255 0 0 212.499999999999943
255 0 255 71.315146906944619
255 255 255 28.532440806196330
3
0 0 255 170.000000000000028
0 255 255 78.122278156376495
255 255 255 64.929265791050753
4
255 0 0 246.104651162790674...

result:

ok ok (10000 test cases)

Test #9:

score: 0
Accepted
time: 45ms
memory: 3672kb

input:

10000
154 183 17
8 28 144
3 227 218
175 43 0
209 191 38
123 96 107
56 179 204
230 197 204
188 100 217
43 189 158
161 254 191
83 240 178
150 193 187
123 122 48
157 207 135
103 84 235
62 53 66
77 2 234
237 56 156
219 127 51
184 225 70
138 102 218
53 203 153
39 98 75
171 45 134
159 215 212
128 35 190
1...

output:

3
0 255 0 73.217821782178220
255 255 0 180.264897951311866
255 255 255 19.170156440654935
3
0 0 255 130.308370044052850
0 255 255 22.984116613214326
255 255 255 11.444661707442343
3
0 255 0 62.027027027026989
0 255 255 272.833937296842066
255 255 255 3.050431180257559
2
255 0 0 158.773584905660357
2...

result:

ok ok (10000 test cases)

Test #10:

score: 0
Accepted
time: 51ms
memory: 3872kb

input:

10000
250 227 91
46 34 201
210 87 230
102 2 191
107 0 185
104 203 241
250 164 144
40 123 155
61 164 38
200 197 253
155 124 18
219 173 90
127 124 225
217 94 50
242 198 116
227 79 191
120 136 155
184 151 174
45 122 243
248 142 31
31 154 253
152 165 224
238 39 128
165 134 229
162 220 33
61 111 11
205 1...

output:

4
255 0 0 209.464285714285694
255 255 0 214.808503840335874
255 255 255 0.000000000000028
255 255 255 92.358446966457350
3
0 0 255 189.114832535885171
255 0 255 14.300849793847298
255 255 255 47.527755827142677
4
0 0 255 113.333333333333499
255 0 255 213.573041912736187
255 255 255 0.000000000000040...

result:

ok ok (10000 test cases)

Test #11:

score: 0
Accepted
time: 51ms
memory: 3636kb

input:

10000
208 135 142
248 171 248
162 65 32
9 162 63
91 20 90
188 236 117
62 200 71
14 228 53
68 196 133
27 159 255
129 86 121
46 216 3
213 65 177
7 28 45
215 136 153
108 54 113
254 122 99
243 222 89
18 255 48
14 157 204
210 33 132
87 4 33
231 222 233
30 14 100
10 45 226
49 210 232
113 79 18
235 109 14
...

output:

3
255 0 0 148.938053097345147
255 0 255 16.110367375583667
255 255 255 192.825131271833982
2
255 0 255 330.572420204710966
255 255 255 172.183405123722650
3
255 0 0 130.184210526315780
255 255 0 42.013351118658250
255 255 255 44.107298711140750
3
0 255 0 131.484374999999972
0 255 255 62.196412608083...

result:

ok ok (10000 test cases)

Test #12:

score: 0
Accepted
time: 45ms
memory: 3596kb

input:

10000
119 133 74
50 106 117
59 203 94
72 223 194
202 156 197
61 81 108
77 80 107
240 230 250
53 54 66
133 197 44
33 113 2
83 54 163
206 241 33
41 83 202
182 57 124
37 155 241
186 245 218
153 80 29
47 83 212
41 32 94
107 89 186
58 161 214
114 106 34
17 89 16
19 117 170
169 115 74
55 143 33
6 182 196
...

output:

4
0 255 0 26.250000000000050
255 255 0 85.168378155649293
255 255 255 0.000000000000069
255 255 255 105.144975287796825
3
0 0 255 18.825503355704701
0 255 255 94.945357029926058
255 255 255 70.381809071560554
3
0 255 0 172.639751552795019
0 255 255 47.851882214957840
255 255 255 77.941037428902291
3...

result:

ok ok (10000 test cases)

Test #13:

score: 0
Accepted
time: 50ms
memory: 3624kb

input:

10000
170 100 234
20 253 12
243 196 46
206 129 235
149 5 166
232 179 7
149 75 45
98 197 156
206 22 133
230 176 54
159 228 135
170 92 118
90 61 180
9 26 18
21 65 122
40 143 87
125 192 199
176 35 144
44 85 243
153 238 203
227 9 212
200 74 226
253 135 20
139 117 222
230 43 212
42 201 224
22 222 152
191...

output:

3
0 0 255 192.000000000000000
255 0 255 118.623846951431773
255 255 255 114.851394732533933
4
0 255 0 252.829787234042556
255 255 0 8.395365754097787
255 255 255 0.000000000000063
255 255 255 16.693841585996264
3
255 0 0 203.135593220338933
255 255 0 186.761411336795618
255 255 255 47.87068690518403...

result:

ok ok (10000 test cases)

Test #14:

score: 0
Accepted
time: 51ms
memory: 3600kb

input:

10000
67 216 241
14 40 250
28 215 219
200 241 181
3 167 13
227 218 113
85 72 151
116 20 162
202 252 17
54 184 231
49 90 219
117 173 19
37 53 223
10 195 119
118 128 187
46 208 215
54 85 104
71 99 34
234 95 0
44 223 10
14 248 47
123 70 75
245 118 231
131 187 137
34 62 21
4 118 233
40 183 96
242 97 190...

output:

4
0 0 255 163.461538461538396
0 255 255 214.728227972463117
255 255 255 0.000000000000028
255 255 255 68.608120196215140
3
0 0 255 249.069767441860449
0 255 255 27.517811695692650
255 255 255 18.763665325500117
3
0 0 255 25.499999999999883
0 255 255 282.615005587977976
255 255 255 28.776064151900421...

result:

ok ok (10000 test cases)

Test #15:

score: 0
Accepted
time: 48ms
memory: 3700kb

input:

10000
252 245 224
4 171 9
240 190 208
69 15 254
4 230 90
0 255 17
6 26 58
150 187 237
239 242 146
255 227 231
232 117 26
44 255 111
183 1 9
121 85 207
15 245 120
247 181 40
1 255 164
244 139 255
131 248 27
161 24 241
63 44 16
207 36 251
15 227 163
49 7 180
27 7 23
61 254 235
14 8 11
200 7 3
26 254 3...

output:

3
255 0 0 178.500000000000171
255 255 0 180.347875339406500
255 255 255 236.362303249698840
3
0 255 0 167.926829268292664
0 255 255 5.367656836770760
255 255 255 5.758547600078828
3
255 0 0 173.617021276595722
255 0 255 74.124496760022240
255 255 255 238.530957637534556
3
0 0 255 253.629032258064512...

result:

ok ok (10000 test cases)

Test #16:

score: 0
Accepted
time: 39ms
memory: 3868kb

input:

10000
10 7 240
232 252 180
5 169 10
1 40 6
252 2 242
245 8 5
249 17 249
255 2 233
12 3 1
2 6 253
252 254 2
251 245 6
254 4 252
10 244 245
254 218 52
255 8 4
20 112 248
253 0 254
250 234 1
226 245 216
11 6 2
245 139 0
8 28 233
1 11 24
246 250 253
9 124 17
255 26 1
14 251 46
2 14 248
233 1 44
12 255 1...

output:

3
0 0 255 239.387755102040785
255 0 255 3.090453372977154
255 255 255 9.848905676677798
3
0 255 0 221.739130434782737
255 255 0 178.297626751182435
255 255 255 188.411464619327205
3
0 255 0 165.489795918367349
0 255 255 5.405074528061004
255 255 255 7.208911152178273
3
0 255 0 34.819277108433717
0 2...

result:

ok ok (10000 test cases)

Test #17:

score: 0
Accepted
time: 34ms
memory: 3636kb

input:

10000
0 3 254
9 1 2
250 254 0
4 1 65
212 3 253
253 255 254
252 1 255
255 230 11
253 215 255
113 12 16
252 253 0
255 254 254
254 255 252
0 32 254
255 36 252
10 1 243
3 46 11
99 3 255
250 0 248
11 5 3
253 254 255
23 2 1
0 253 4
255 255 248
255 237 250
7 13 1
251 251 246
0 0 4
0 2 1
254 254 0
189 3 0
2...

output:

2
0 0 255 253.988095238095241
0 255 255 3.000023620466347
3
255 0 0 7.055335968379434
255 0 255 1.400277846033872
255 255 255 1.711765568143825
2
0 255 0 204.000000000000284
255 255 0 254.950975679639186
3
0 0 255 61.972111553784863
255 0 255 3.777400343512491
255 255 255 1.592503868798173
3
0 0 255...

result:

ok ok (10000 test cases)

Test #18:

score: 0
Accepted
time: 29ms
memory: 3600kb

input:

10000
0 253 255
255 252 2
255 0 255
250 253 255
253 0 255
252 251 236
8 255 0
247 254 254
2 255 255
255 255 252
0 0 4
6 250 0
7 32 0
0 2 255
255 9 255
3 255 1
255 255 242
254 0 0
0 0 254
0 255 255
1 0 9
255 255 2
0 255 0
0 0 255
254 9 1
253 255 254
252 0 255
0 0 255
254 0 252
255 247 0
2 250 255
255...

output:

2
0 0 255 255.000000000000000
0 255 255 253.000000000000000
3
255 0 0 255.000000000000000
255 255 0 251.976284584980249
255 255 255 2.000140600285280
1
255 0 255 360.624458405139251
3
0 0 255 255.000000000000000
0 255 255 153.000000000000597
255 255 255 269.258240356724968
2
0 0 255 255.000000000000...

result:

ok ok (10000 test cases)

Test #19:

score: 0
Accepted
time: 21ms
memory: 3616kb

input:

10000
0 0 0
255 0 255
0 255 255
255 255 1
0 0 0
0 255 1
255 0 254
0 255 0
0 203 255
0 2 0
255 0 255
255 254 0
255 0 255
255 255 228
0 255 255
0 255 255
0 254 0
253 0 0
242 0 0
255 0 0
255 252 0
0 0 0
0 0 0
255 255 255
0 0 255
255 255 0
4 255 0
0 1 0
0 0 255
0 253 253
0 255 255
0 0 255
255 0 0
1 255 ...

output:

0
1
255 0 255 360.624458405139251
1
0 255 255 360.624458405139251
2
255 255 0 360.624458405139251
255 255 255 1.000000000000000
0
2
0 255 0 255.000000000000000
0 255 255 1.000000000000000
2
255 0 0 255.000000000000000
255 0 255 254.000000000000000
1
0 255 0 255.000000000000000
2
0 0 255 255.00000000...

result:

ok ok (10000 test cases)

Test #20:

score: 0
Accepted
time: 9ms
memory: 3632kb

input:

10000
0 0 0
0 255 255
255 0 255
255 255 0
255 255 255
255 0 0
255 255 255
0 0 255
0 0 0
0 0 255
255 255 0
0 0 255
255 0 0
0 0 0
255 255 0
0 0 255
0 0 0
255 255 0
0 0 255
0 255 0
255 0 255
0 255 255
0 255 0
0 255 0
1 0 255
255 0 254
255 0 255
255 255 255
0 255 255
255 0 255
255 0 255
0 255 255
255 25...

output:

0
1
0 255 255 360.624458405139251
1
255 0 255 360.624458405139251
1
255 255 0 360.624458405139251
1
255 255 255 441.672955930063665
1
255 0 0 255.000000000000000
1
255 255 255 441.672955930063665
1
0 0 255 255.000000000000000
0
1
0 0 255 255.000000000000000
1
255 255 0 360.624458405139251
1
0 0 255 ...

result:

ok ok (10000 test cases)