QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#376345 | #2523. Commemorative Dice | kevinyang# | AC ✓ | 1ms | 3844kb | C++20 | 7.5kb | 2024-04-04 08:17:46 | 2024-04-04 08:17:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
/* Macros {{{ */
/* A lot of this is from some of Benq's submissions
[https://codeforces.com/profile/Benq]
Ugly af to the eyes, but with vim fold its barable
Hopefully c++20 concepts can make all this stuff must cleaner */
/* Basics {{{ */
using ll = long long;
using ld = long double;
using str = string;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
#define mp make_pair
#define fi first
#define se second
#define arr array
#define ve vector
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
using vpi = vector<pi>;
using vpll = vector<pll>;
using vpld = vector<pld>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvld = vector<vld>;
using vvpi = vector<vpi>;
using vvpll = vector<vpll>;
using vvpld = vector<vpld>;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz size()
#define rsz(a) resize(a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define For(i, a, b) for (int i = a; i < b; ++i)
#define Rof(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define rep(a) For(_, 0, a)
#define each(a, x) for (auto &a : x)
#define reach(a, x) for (auto a = x.rbegin(); a != x.rend(); ++a)
template <typename T, typename U>
inline void cmin(T &x, U y) {
if (y < x) x = y;
}
template <typename T, typename U>
inline void cmax(T &x, U y) {
if (x < y) x = y;
}
/*}}}*/
/* IO {{{ */
/* Template Macros {{{ */
#define tcT template <class T
#define tcTU tcT, class U
#define tcTUU tcT, class... U
/*}}}*/
inline namespace Helpers { /*{{{*/
tcT, class = void > struct is_iterable : false_type {};
tcT > struct is_iterable<
T, void_t<decltype(begin(declval<T>())), decltype(end(declval<T>()))>>
: true_type {};
tcT > constexpr bool is_iterable_v = is_iterable<T>::value;
tcT, class = void > struct is_readable : false_type {};
tcT > struct is_readable<T, typename std::enable_if_t<is_same_v<
decltype(cin >> declval<T &>()), istream &>>>
: true_type {};
tcT > constexpr bool is_readable_v = is_readable<T>::value;
tcT, class = void > struct is_printable : false_type {};
tcT > struct is_printable<T, typename std::enable_if_t<is_same_v<
decltype(cout << declval<T>()), ostream &>>>
: true_type {};
tcT > constexpr bool is_printable_v = is_printable<T>::value;
} /* namespace Helpers */
/*}}}*/
inline namespace Input { /*{{{*/
tcT > constexpr bool needs_input_v = !is_readable_v<T> && is_iterable_v<T>;
tcTUU > void re(T &t, U &...u);
tcTU > void re(pair<T, U> &p); /* pairs */
/* re: read{{{ */
tcT > typename enable_if<is_readable_v<T>, void>::type re(T &x) {
cin >> x;
} /* default */
tcT > typename enable_if<needs_input_v<T>, void>::type re(
T &i); // vectors, arrays, etc...
tcTU > void re(pair<T, U> &p) { re(p.fi, p.se); } // pairs
tcT > typename enable_if<needs_input_v<T>, void>::type re(T &i) {
each(x, i) re(x);
}
tcTUU > void re(T &t, U &...u) {
re(t);
re(u...);
} /* read multiple}}} */
/* rv: resize and read vectors{{{ */
void rv(size_t) {}
tcTUU > void rv(size_t N, ve<T> &t, U &...u);
template <class... U>
void rv(size_t, size_t N2, U &...u);
tcTUU > void rv(size_t N, ve<T> &t, U &...u) {
t.rsz(N);
re(t);
rv(N, u...);
}
template <class... U>
void rv(size_t, size_t N2, U &...u) {
rv(N2, u...);
} /*}}}*/
/* dumb shortcuts to read in ints{{{ */
void decrement() {} /* subtract one from each */
tcTUU > void decrement(T &t, U &...u) {
--t;
decrement(u...);
}
#define ints(...) \
int __VA_ARGS__; \
re(__VA_ARGS__);
#define int1(...) \
ints(__VA_ARGS__); \
decrement(__VA_ARGS__); /*}}}*/
} /* namespace Input */
/*}}}*/
inline namespace ToString { /*{{{*/
tcT > constexpr bool needs_output_v = !is_printable_v<T> && is_iterable_v<T>;
/* ts: string representation to print */
tcT > typename enable_if<is_printable_v<T>, str>::type ts(T v) {
stringstream ss;
ss << fixed << setprecision(15) << v;
return ss.str();
} /* default */
tcT > str bit_vec(T t) { /* bit vector to string */
str res = "{";
For(i, 0, t.sz) res += ts(t[i]);
res += "}";
return res;
}
str ts(ve<bool> v) { return bit_vec(v); }
template <size_t SZ>
str ts(bitset<SZ> b) {
return bit_vec(b);
} /* bit vector */
tcTU > str ts(pair<T, U> p); /* pairs */
tcT > typename enable_if<needs_output_v<T>, str>::type ts(
T v); /* vectors, arrays */
tcTU > str ts(pair<T, U> p) { return "(" + ts(p.fi) + ", " + ts(p.se) + ")"; }
tcT > typename enable_if<is_iterable_v<T>, str>::type ts_sep(T v, str sep) {
/* convert container to string w/ separator sep */
bool fst = 1;
str res = "";
for (const auto &x : v) {
if (!fst) res += sep;
fst = 0;
res += ts(x);
}
return res;
}
tcT > typename enable_if<needs_output_v<T>, str>::type ts(T v) {
return "{" + ts_sep(v, ", ") + "}";
}
/* for nested DS */
template <int, class T>
typename enable_if<!needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
return {ts(v)};
}
template <int lev, class T>
typename enable_if<needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
if (lev == 0 || !v.sz) return {ts(v)};
ve<str> res;
for (const auto &t : v) {
if (res.sz) res.back() += ",";
ve<str> tmp = ts_lev<lev - 1>(t);
res.insert(end(res), all(tmp));
}
For(i, 0, res.sz) {
str bef = " ";
if (i == 0) bef = "{";
res[i] = bef + res[i];
}
res.back() += "}";
return res;
}
} /* namespace ToString */
/*}}}*/
inline namespace Output { /*{{{*/
template <class T>
void pr_sep(ostream &os, str, const T &t) {
os << ts(t);
}
template <class T, class... U>
void pr_sep(ostream &os, str sep, const T &t, const U &...u) {
pr_sep(os, sep, t);
os << sep;
pr_sep(os, sep, u...);
}
/* print w/ no spaces */
template <class... T>
void pr(const T &...t) {
pr_sep(cout, "", t...);
}
/* print w/ spaces, end with newline */
void ps() { cout << "\n"; }
template <class... T>
void ps(const T &...t) {
pr_sep(cout, " ", t...);
ps();
}
/* debug to cerr */
template <class... T>
void dbg_out(const T &...t) {
pr_sep(cerr, " | ", t...);
cerr << endl;
}
void loc_info(int line, str names) {
cerr << "Line(" << line << ") -> [" << names << "]: ";
}
template <int lev, class T>
void dbgl_out(const T &t) {
cerr << "\n\n" << ts_sep(ts_lev<lev>(t), "\n") << "\n" << endl;
}
} /* namespace Output */
/*}}}}}}}}}*/
vi d1, d2;
void solve() {
rv(6, d1), rv(6, d2);
int num = 0;
for(int i=0; i<6; ++i) for(int j=0; j<6; ++j) num += (d1[i] > d2[j]);
int den = 36;
while(num%2 == 0 && den%2 == 0) num/=2, den/=2;
while(num%3 == 0 && den%3 == 0) num/=3, den/=3;
cout << num << '/' << den << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
/* cout << fixed << setprecision(6); */
int t = 1;
// cin >> t;
for (int i = 0; i < t; i++) solve();
return 0;
// you should actually read the stuff at the bottom
}
/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3632kb
input:
1 1 16 1 1 1 1 1 1 1 1 16
output:
5/36
result:
ok single line: '5/36'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
6 3 3 3 3 3 3 3 3 3 3 6
output:
5/36
result:
ok single line: '5/36'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
2 2 2 2 11 2 3 7 2 5 2 2
output:
1/6
result:
ok single line: '1/6'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 1 2 1 15 1 5 3 2 5 2 4
output:
1/6
result:
ok single line: '1/6'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
1 1 1 15 2 1 6 2 2 6 1 4
output:
7/36
result:
ok single line: '7/36'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
1 1 15 1 2 1 4 3 8 2 3 1
output:
7/36
result:
ok single line: '7/36'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
1 14 2 1 2 1 3 4 7 3 3 1
output:
2/9
result:
ok single line: '2/9'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
3 2 2 3 2 9 2 3 4 3 6 3
output:
2/9
result:
ok single line: '2/9'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
2 1 2 1 2 13 2 1 9 3 3 3
output:
1/4
result:
ok single line: '1/4'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
3 4 3 4 3 4 1 1 1 1 8 9
output:
2/3
result:
ok single line: '2/3'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
2 4 1 2 11 1 4 3 2 3 4 5
output:
1/4
result:
ok single line: '1/4'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
3 4 2 2 9 1 4 3 2 4 3 5
output:
5/18
result:
ok single line: '5/18'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
1 1 10 1 1 7 1 3 1 10 2 4
output:
5/18
result:
ok single line: '5/18'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
4 3 9 1 1 3 4 3 5 3 5 1
output:
11/36
result:
ok single line: '11/36'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
2 6 3 3 3 4 2 4 3 4 4 4
output:
11/36
result:
ok single line: '11/36'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 1 5 1 11 2 1 8 1 3 2 6
output:
1/3
result:
ok single line: '1/3'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 1 3 4 1 11 8 2 5 4 1 1
output:
1/3
result:
ok single line: '1/3'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
1 2 11 3 1 3 1 2 4 2 5 7
output:
13/36
result:
ok single line: '13/36'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3492kb
input:
4 1 4 1 9 2 4 6 6 2 1 2
output:
13/36
result:
ok single line: '13/36'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
1 1 1 7 4 7 3 8 2 1 2 5
output:
7/18
result:
ok single line: '7/18'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
1 2 3 4 5 6 3 4 3 4 3 4
output:
5/12
result:
ok single line: '5/12'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
1 5 1 1 7 6 1 8 1 4 5 2
output:
7/18
result:
ok single line: '7/18'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
3 5 2 1 3 7 7 4 2 1 3 4
output:
5/12
result:
ok single line: '5/12'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
4 1 2 7 6 1 6 3 1 3 4 4
output:
5/12
result:
ok single line: '5/12'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5 3 1 1 5 6 2 5 5 3 2 4
output:
4/9
result:
ok single line: '4/9'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
4 4 5 1 5 2 7 3 2 2 2 5
output:
4/9
result:
ok single line: '4/9'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
2 5 7 3 1 3 4 2 1 2 8 4
output:
17/36
result:
ok single line: '17/36'
Test #28:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
3 4 1 7 3 3 2 4 1 4 9 1
output:
17/36
result:
ok single line: '17/36'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 4 3 3 2 6 2 5 2 5 5 2
output:
1/2
result:
ok single line: '1/2'
Test #30:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
1 1 5 6 6 2 2 1 1 3 1 13
output:
1/2
result:
ok single line: '1/2'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
3 2 3 5 4 4 3 3 9 1 4 1
output:
19/36
result:
ok single line: '19/36'
Test #32:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
1 2 3 4 5 6 8 7 2 2 1 1
output:
1/2
result:
ok single line: '1/2'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
6 3 2 5 1 4 3 3 1 10 2 2
output:
19/36
result:
ok single line: '19/36'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
2 1 3 8 5 2 1 2 1 3 1 13
output:
5/9
result:
ok single line: '5/9'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
4 2 2 7 3 3 1 4 1 1 9 5
output:
5/9
result:
ok single line: '5/9'
Test #36:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
4 2 2 1 7 5 1 3 3 1 12 1
output:
7/12
result:
ok single line: '7/12'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
1 4 4 4 6 2 1 1 13 1 4 1
output:
7/12
result:
ok single line: '7/12'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
2 2 3 5 8 1 1 1 1 4 13 1
output:
11/18
result:
ok single line: '11/18'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
5 7 3 3 1 2 1 13 1 2 2 2
output:
11/18
result:
ok single line: '11/18'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
4 1 4 2 3 7 1 2 14 1 1 2
output:
23/36
result:
ok single line: '23/36'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
1 3 3 4 5 5 1 2 2 3 2 11
output:
23/36
result:
ok single line: '23/36'
Test #42:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
3 3 6 3 4 2 3 2 1 12 2 1
output:
2/3
result:
ok single line: '2/3'
Test #43:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
3 4 3 3 6 2 1 2 1 2 3 12
output:
2/3
result:
ok single line: '2/3'
Test #44:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 3 6 5 3 3 2 13 2 1 1 2
output:
25/36
result:
ok single line: '25/36'
Test #45:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 3 3 1 5 4 1 14 2 1 2 1
output:
25/36
result:
ok single line: '25/36'
Test #46:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
2 4 4 3 4 4 1 2 2 1 12 3
output:
13/18
result:
ok single line: '13/18'
Test #47:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
4 5 4 2 4 2 13 3 2 1 1 1
output:
13/18
result:
ok single line: '13/18'
Test #48:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
6 5 2 2 2 4 1 1 3 14 1 1
output:
3/4
result:
ok single line: '3/4'
Test #49:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
4 2 3 6 3 3 1 2 2 13 1 2
output:
3/4
result:
ok single line: '3/4'
Test #50:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
3 4 4 4 2 4 1 1 2 14 2 1
output:
7/9
result:
ok single line: '7/9'
Test #51:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
6 2 2 3 5 3 15 2 1 1 1 1
output:
7/9
result:
ok single line: '7/9'
Test #52:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
3 6 3 4 2 3 1 15 1 2 1 1
output:
29/36
result:
ok single line: '29/36'
Test #53:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
3 3 3 6 4 2 15 1 1 2 1 1
output:
29/36
result:
ok single line: '29/36'
Test #54:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
6 2 2 4 2 5 1 1 1 1 1 16
output:
5/6
result:
ok single line: '5/6'
Test #55:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
5 4 2 5 3 2 1 1 16 1 1 1
output:
5/6
result:
ok single line: '5/6'