QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#798103 | #701. Proofs | SorahISA | AC ✓ | 564ms | 19524kb | C++23 | 11.0kb | 2024-12-04 04:48:22 | 2024-12-04 04:48:24 |
Judging History
answer
#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA
void solve() {
int N; cin >> N;
set<string> conclusions;
for (int i = 1; i <= N; ++i) {
bool flag = true; string S;
while (cin >> S and S != "->") { if (not conclusions.contains(S)) flag = false; }
cin >> S; conclusions.ee(S);
if (not flag) { print(i); return; }
}
print("correct");
}
int32_t main() {
fastIO();
int t = 1; // cin >> t;
for (int _ = 1; _ <= t; ++_) {
// cout << "Case #" << _ << ": ";
solve();
}
return 0;
}
#else
#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
// #include <bits/extc++.h>
// #include <tr2/dynamic_bitset>
using i64 = long long;
using i128 = __int128;
#define int i64
using f80 = long double;
using f128 = __float128;
#define double f80
using pii = pair<int, int>;
template <typename T> using Prior = std::priority_queue<T>;
template <typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>;
// #define X first
// #define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define SZ(x) ((int)(x).size())
#define popcnt(x) __builtin_popcountll(x)
// template <size_t D, typename T> struct Vec : vector<Vec<D-1, T>> {
// static_assert(D >= 1, "Vector dimension must be greater than zero!");
// template <typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D-1, T>>(n, Vec<D-1, T>(args...)) {}
// };
// template <typename T> struct Vec<1, T> : vector<T> {
// Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
// };
template <typename T> ostream& operator << (ostream &os, const vector<T> &vec)
{ for (size_t i = 0; i < size(vec); ++i) { if (i) os << " "; os << vec[i]; } return os; }
#ifdef local
#define fastIO() void()
#define debug(...) \
_color.emplace_back("\u001b[31m"), \
fprintf(stderr, "%sAt [%s], line %d: (%s) = ", _color.back().c_str(), __FUNCTION__, __LINE__, #__VA_ARGS__), \
_do(__VA_ARGS__), _color.pop_back(), \
fprintf(stderr, "%s", _color.back().c_str())
#define print(...) \
fprintf(stdout, "%s", "\u001b[36m"), \
_P(__VA_ARGS__), \
fprintf(stdout, "%s", "\u001b[0m")
deque<string> _color{"\u001b[0m"};
template <typename T> concept is_string = is_same_v<T, string&> or is_same_v<T, const string&>;
template <typename T> concept is_iterable = requires (T _t) { begin(_t); };
template <typename T> inline void _print_err(T &&_t);
template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I < sizeof...(U), void>::type _print_err(const tuple<U...> &_t);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I < sizeof...(U), void>::type _print_err(tuple<U...> &_t);
template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu);
inline void _do() { cerr << "\n"; }
template <typename T> inline void _do(T &&_t) { _print_err(_t), cerr << "\n"; }
template <typename T, typename ...U> inline void _do(T &&_t, U &&..._u) { _print_err(_t), cerr << ", ", _do(_u...); }
#else
#define fastIO() cin.tie(0)->sync_with_stdio(0)
#define debug(...) void()
#define print(...) _P(__VA_ARGS__)
#endif
inline void _P() { cout << "\n"; }
template <typename T> inline void _P(T &&_t) { cout << _t << "\n"; }
template <typename T, typename ...U> inline void _P(T &&_t, U &&..._u) { cout << _t << " ", _P(_u...); }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int getRand(int L, int R) {
if (L > R) swap(L, R);
return (int)(rng() % ((uint64_t)R - L + 1) + L);
}
template <typename T, typename U> bool chmin(T &lhs, U rhs) { return lhs > rhs ? lhs = rhs, 1 : 0; }
template <typename T, typename U> bool chmax(T &lhs, U rhs) { return lhs < rhs ? lhs = rhs, 1 : 0; }
template <typename T> void make_unique(vector<T> &vec) {
if (not is_sorted(ALL(vec))) sort(ALL(vec));
vec.erase(unique(ALL(vec)), end(vec));
}
/// below are Fast I/O and _print_err templates ///
/*
/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
#include <unistd.h>
const int S = 65536;
int OP = 0;
char OB[S];
inline char RC() {
static char buf[S], *p = buf, *q = buf;
return p == q and (q = (p = buf) + read(0, buf, S)) == buf ? -1 : *p++;
}
inline int RI() {
static char c;
int a;
while (((c = RC()) < '0' or c > '9') and c != '-' and c != -1);
if (c == '-') {
a = 0;
while ((c = RC()) >= '0' and c <= '9') a *= 10, a -= c ^ '0';
}
else {
a = c ^ '0';
while ((c = RC()) >= '0' and c <= '9') a *= 10, a += c ^ '0';
}
return a;
}
inline void WI(int n, char c = '\n') {
static char buf[20], p;
if (n == 0) OB[OP++] = '0';
p = 0;
if (n < 0) {
OB[OP++] = '-';
while (n) buf[p++] = '0' - (n % 10), n /= 10;
}
else {
while (n) buf[p++] = '0' + (n % 10), n /= 10;
}
for (--p; p >= 0; --p) OB[OP++] = buf[p];
OB[OP++] = c;
if (OP > S-20) write(1, OB, OP), OP = 0;
}
/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
*/
#ifdef local
template <typename T> inline void _print_err(T &&_t) { cerr << _t; }
template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>) {
_color.emplace_back(_color.back()), ++_color.back()[3];
cerr << _color.back() << "[";
for (bool _first = true; auto &_x : _t) {
if (!_first) cerr << ", ";
_print_err(_x), _first = false;
}
cerr << "]" << (_color.pop_back(), _color.back());
}
template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu) {
_color.emplace_back(_color.back()), ++_color.back()[3];
cerr << _color.back() << "(";
_print_err(_tu.first), cerr << ", ", _print_err(_tu.second);
cerr << ")" << (_color.pop_back(), _color.back());
return os;
}
template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &) {
cerr << ")" << (_color.pop_back(), _color.back());
}
template <size_t I = 0, typename ...U> inline typename enable_if<I < sizeof...(U), void>::type _print_err(const tuple<U...> &_t) {
if (!I) {
_color.emplace_back(_color.back()), ++_color.back()[3];
cerr << _color.back();
}
cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}
template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &) {
cerr << ")" << (_color.pop_back(), _color.back());
}
template <size_t I = 0, typename ...U> inline typename enable_if<I < sizeof...(U), void>::type _print_err(tuple<U...> &_t) {
if (!I) {
_color.emplace_back(_color.back()), ++_color.back()[3];
cerr << _color.back();
}
cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}
#endif
#endif
/**
*
*
*
* iiiiii iiiiiiiiii iiiiiiiiiiiiii
* iiiiiiiiiiiii iiiiiii iiii iiiiiiiiiiiiiii ii iiii
* iiiiiiii iiiiiiiii iiii iiii iii iii iiiiiiiiii
* iiiiiii iiiiii iiii iiii ii iiiiiiiiii iiii iiii
* iiiiii iiiii iiii iiii iii iiii iiiiiiiiiiiiiiiii ii
* iiiiii iiiiiii iiiiiii iiiiiiii iii iiiiiiiiiiiiii iii iiii
* iiiiii iiiiiii iiiii ii iiii iiiiiiiiiii iiii iii iiii iiii iii
* iiiii iiiiiiii ii iiiii iiii iiiiiiiii iii iii iii iii ii iiii
* iiiiii iiiiiiii iiiii iiiii iiiiiiiiiiiiiiii iii iii ii iii iii iiii
* iiiii iiiiii iiii iiiiii iiiiiii iii iii iiii ii i ii iii iii
* iiiiii iiii iiiiiiiiiiiiiii iii iiii iiiii iii ii iii iii ii
* iiiii iiiiiiii iiiiiiiiii iiii iiiiiiiii ii iii ii
* iiiii iiiiii iiii iiiii iii ii ii i
* iiiiii iiiiiiii iiiii iiiii ii ii ii
* iiiii iiii iiii iiiiiiiiiiii ii
* iii iiii iiii iiiiiiii
* iiiii iiii
* iiii iiii
* iiii iiiii
* iii iiiii
* iii iiiii
* iii iiiiii
* iiiiiiiii
* iiiiii
*
*
*
**/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
3 -> ALICE -> BOB ALICE BOB -> CARL
output:
correct
result:
ok single line: 'correct'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1 A -> B
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 484ms
memory: 19524kb
input:
400000 -> KKGA KKGA -> KKGA KKGA -> KKGA KKGA KKGA KKGA KKGA -> KKGA KKGA KKGA KKGA KKGA KKGA -> NLWS NLWS NLWS KKGA KKGA KKGA -> NZXM KKGA NLWS KKGA KKGA -> FIWQ NLWS NLWS NZXM -> SFYF NZXM NLWS FIWQ FIWQ -> NLWS -> XIZH FIWQ NLWS FIWQ FIWQ -> PPBD PPBD XIZH -> NLWS PPBD -> CMAW SFYF PPBD XIZH NLWS...
output:
correct
result:
ok single line: 'correct'
Test #4:
score: 0
Accepted
time: 180ms
memory: 10696kb
input:
400000 -> KKGA KKGA -> KKGA KKGA -> KKGA KKGA KKGA KKGA KKGA -> KKGA KKGA KKGA KKGA KKGA KKGA -> NLWS NLWS NLWS KKGA KKGA KKGA -> NZXM KKGA NLWS KKGA KKGA -> FIWQ NLWS NLWS NZXM -> SFYF NZXM NLWS FIWQ FIWQ -> NLWS -> XIZH FIWQ NLWS FIWQ FIWQ -> PPBD PPBD XIZH -> NLWS PPBD -> CMAW SFYF PPBD XIZH NLWS...
output:
180688
result:
ok single line: '180688'
Test #5:
score: 0
Accepted
time: 488ms
memory: 19240kb
input:
400000 -> HNHI HNHI HNHI HNHI HNHI HNHI -> HNHI HNHI HNHI HNHI HNHI HNHI -> IION -> HNHI IION HNHI IION HNHI -> IION HNHI HNHI IION HNHI -> KQZH -> KQZH -> HNHI KQZH IION HNHI IION -> IION IION HNHI IION KQZH IION -> IION HNHI KQZH -> HNHI KQZH IION KQZH HNHI IION -> IION -> KZHK HNHI KQZH -> TFUO T...
output:
correct
result:
ok single line: 'correct'
Test #6:
score: 0
Accepted
time: 331ms
memory: 15396kb
input:
400000 -> HNHI HNHI HNHI HNHI HNHI HNHI -> HNHI HNHI HNHI HNHI HNHI HNHI -> IION -> HNHI IION HNHI IION HNHI -> IION HNHI HNHI IION HNHI -> KQZH -> KQZH -> HNHI KQZH IION HNHI IION -> IION IION HNHI IION KQZH IION -> IION HNHI KQZH -> HNHI KQZH IION KQZH HNHI IION -> IION -> KZHK HNHI KQZH -> TFUO T...
output:
301169
result:
ok single line: '301169'
Test #7:
score: 0
Accepted
time: 464ms
memory: 19208kb
input:
400000 -> VDAG VDAG -> GSRD VDAG VDAG GSRD GSRD -> GSRD VDAG GSRD -> SHIG -> SHIG GSRD SHIG SHIG SHIG VDAG -> GSRD -> EBSR SHIG -> VDAG SHIG -> GSRD GSRD -> EBSR EBSR SHIG -> EBSR VDAG GSRD -> GSRD -> GSRD SHIG -> VDAG EBSR -> EBSR EBSR -> DGII SHIG GSRD SHIG DGII VDAG -> REJI DGII EBSR -> VDAG EBSR...
output:
correct
result:
ok single line: 'correct'
Test #8:
score: 0
Accepted
time: 300ms
memory: 14564kb
input:
400000 -> VDAG VDAG -> GSRD VDAG VDAG GSRD GSRD -> GSRD VDAG GSRD -> SHIG -> SHIG GSRD SHIG SHIG SHIG VDAG -> GSRD -> EBSR SHIG -> VDAG SHIG -> GSRD GSRD -> EBSR EBSR SHIG -> EBSR VDAG GSRD -> GSRD -> GSRD SHIG -> VDAG EBSR -> EBSR EBSR -> DGII SHIG GSRD SHIG DGII VDAG -> REJI DGII EBSR -> VDAG EBSR...
output:
274765
result:
ok single line: '274765'
Test #9:
score: 0
Accepted
time: 495ms
memory: 19256kb
input:
400000 -> GWWX GWWX GWWX GWWX -> QWMD QWMD QWMD QWMD -> GWWX QWMD QWMD GWWX QWMD QWMD -> EUAO GWWX GWWX EUAO QWMD GWWX -> EUAO QWMD EUAO QWMD -> EUAO QWMD EUAO -> EUAO EUAO GWWX QWMD EUAO -> GWWX EUAO GWWX EUAO GWWX GWWX -> TCQG TCQG GWWX EUAO -> HFUK -> EHFO HFUK QWMD -> EUAO TCQG -> YGAX TCQG -> G...
output:
correct
result:
ok single line: 'correct'
Test #10:
score: 0
Accepted
time: 176ms
memory: 10244kb
input:
400000 -> GWWX GWWX GWWX GWWX -> QWMD QWMD QWMD QWMD -> GWWX QWMD QWMD GWWX QWMD QWMD -> EUAO GWWX GWWX EUAO QWMD GWWX -> EUAO QWMD EUAO QWMD -> EUAO QWMD EUAO -> EUAO EUAO GWWX QWMD EUAO -> GWWX EUAO GWWX EUAO GWWX GWWX -> TCQG TCQG GWWX EUAO -> HFUK -> EHFO HFUK QWMD -> EUAO TCQG -> YGAX TCQG -> G...
output:
168851
result:
ok single line: '168851'
Test #11:
score: 0
Accepted
time: 564ms
memory: 19248kb
input:
400000 -> THGK THGK THGK THGK THGK -> THGK THGK THGK THGK THGK THGK -> THGK THGK THGK THGK -> GHIE GHIE THGK THGK THGK GHIE -> GHIE THGK THGK -> GKRV GKRV GKRV GHIE GHIE GHIE -> OLHE -> YDOI GKRV -> HMJI OLHE GHIE HMJI YDOI -> HDIS OLHE THGK HMJI HMJI GHIE -> FGQU OLHE FGQU GKRV -> QAHU OLHE -> GHIE...
output:
correct
result:
ok single line: 'correct'
Test #12:
score: 0
Accepted
time: 80ms
memory: 7436kb
input:
400000 -> THGK THGK THGK THGK THGK -> THGK THGK THGK THGK THGK THGK -> THGK THGK THGK THGK -> GHIE GHIE THGK THGK THGK GHIE -> GHIE THGK THGK -> GKRV GKRV GKRV GHIE GHIE GHIE -> OLHE -> YDOI GKRV -> HMJI OLHE GHIE HMJI YDOI -> HDIS OLHE THGK HMJI HMJI GHIE -> FGQU OLHE FGQU GKRV -> QAHU OLHE -> GHIE...
output:
96103
result:
ok single line: '96103'
Test #13:
score: 0
Accepted
time: 25ms
memory: 5384kb
input:
40000 -> NSBU NSBU NSBU -> NSBU NSBU -> NSBU NSBU -> NSBU NSBU NSBU NSBU NSBU NSBU -> NSBU NSBU NSBU NSBU NSBU NSBU -> NSBU -> JSMD JSMD NSBU JSMD -> JSMD JSMD NSBU NSBU NSBU -> LFWS -> IZXW -> LFWS LFWS IZXW LFWS -> TKZF NSBU -> WKRJ -> QZMN IZXW NSBU LFWS LFWS -> GGUB QZMN LFWS -> QHKA -> NSBU QZM...
output:
correct
result:
ok single line: 'correct'
Test #14:
score: 0
Accepted
time: 13ms
memory: 4612kb
input:
40000 -> NSBU NSBU NSBU -> NSBU NSBU -> NSBU NSBU -> NSBU NSBU NSBU NSBU NSBU NSBU -> NSBU NSBU NSBU NSBU NSBU NSBU -> NSBU -> JSMD JSMD NSBU JSMD -> JSMD JSMD NSBU NSBU NSBU -> LFWS -> IZXW -> LFWS LFWS IZXW LFWS -> TKZF NSBU -> WKRJ -> QZMN IZXW NSBU LFWS LFWS -> GGUB QZMN LFWS -> QHKA -> NSBU QZM...
output:
19455
result:
ok single line: '19455'
Test #15:
score: 0
Accepted
time: 30ms
memory: 5220kb
input:
40000 -> ILLY ILLY ILLY -> MMVI ILLY ILLY ILLY -> LQWF LQWF LQWF MMVI LQWF -> ZNDO LQWF ILLY LQWF MMVI -> DECK MMVI DECK DECK -> UKGG ILLY -> GHIB LQWF MMVI LQWF ZNDO -> LQWF -> XOLZ XOLZ LQWF ILLY -> LQWF DECK GHIB ILLY -> CJLS DECK -> XOLZ UKGG DECK XOLZ LQWF -> RUDF RUDF XOLZ LQWF MMVI UKGG -> EY...
output:
correct
result:
ok single line: 'correct'
Test #16:
score: 0
Accepted
time: 8ms
memory: 4160kb
input:
40000 -> ILLY ILLY ILLY -> MMVI ILLY ILLY ILLY -> LQWF LQWF LQWF MMVI LQWF -> ZNDO LQWF ILLY LQWF MMVI -> DECK MMVI DECK DECK -> UKGG ILLY -> GHIB LQWF MMVI LQWF ZNDO -> LQWF -> XOLZ XOLZ LQWF ILLY -> LQWF DECK GHIB ILLY -> CJLS DECK -> XOLZ UKGG DECK XOLZ LQWF -> RUDF RUDF XOLZ LQWF MMVI UKGG -> EY...
output:
13109
result:
ok single line: '13109'
Test #17:
score: 0
Accepted
time: 26ms
memory: 5256kb
input:
40000 -> UFRY -> CWDN CWDN -> UFRY CWDN UFRY UFRY CWDN CWDN -> GAUH GAUH GAUH -> GAUH CWDN CWDN GAUH -> BEFK UFRY CWDN -> BEFK BEFK UFRY -> GAUH UFRY GAUH BEFK -> VNQF CWDN UFRY -> IHWC CWDN GAUH CWDN -> KHNQ BEFK -> KHNQ UFRY CWDN UFRY KHNQ VNQF -> IHWC GAUH KHNQ KHNQ BEFK -> XJEU UFRY UFRY -> UFRY...
output:
correct
result:
ok single line: 'correct'
Test #18:
score: 0
Accepted
time: 7ms
memory: 4292kb
input:
40000 -> UFRY -> CWDN CWDN -> UFRY CWDN UFRY UFRY CWDN CWDN -> GAUH GAUH GAUH -> GAUH CWDN CWDN GAUH -> BEFK UFRY CWDN -> BEFK BEFK UFRY -> GAUH UFRY GAUH BEFK -> VNQF CWDN UFRY -> IHWC CWDN GAUH CWDN -> KHNQ BEFK -> KHNQ UFRY CWDN UFRY KHNQ VNQF -> IHWC GAUH KHNQ KHNQ BEFK -> XJEU UFRY UFRY -> UFRY...
output:
16323
result:
ok single line: '16323'
Test #19:
score: 0
Accepted
time: 29ms
memory: 5204kb
input:
40000 -> CYSA CYSA CYSA -> OVAU CYSA CYSA OVAU OVAU CYSA -> ZGCU CYSA -> CAMA CAMA CAMA CAMA CYSA -> ZEUY CYSA CYSA ZEUY -> OVAU ZEUY -> CAMA CAMA ZEUY CYSA CYSA -> BTJU CAMA -> HECU BTJU ZEUY HECU -> HECU ZGCU CYSA BTJU -> DAIU -> BTJU CYSA BTJU DAIU -> CAMA -> DAIU ZEUY ZEUY CAMA ZGCU -> NGVN -> Y...
output:
correct
result:
ok single line: 'correct'
Test #20:
score: 0
Accepted
time: 16ms
memory: 4592kb
input:
40000 -> CYSA CYSA CYSA -> OVAU CYSA CYSA OVAU OVAU CYSA -> ZGCU CYSA -> CAMA CAMA CAMA CAMA CYSA -> ZEUY CYSA CYSA ZEUY -> OVAU ZEUY -> CAMA CAMA ZEUY CYSA CYSA -> BTJU CAMA -> HECU BTJU ZEUY HECU -> HECU ZGCU CYSA BTJU -> DAIU -> BTJU CYSA BTJU DAIU -> CAMA -> DAIU ZEUY ZEUY CAMA ZGCU -> NGVN -> Y...
output:
23339
result:
ok single line: '23339'
Test #21:
score: 0
Accepted
time: 25ms
memory: 5216kb
input:
40000 -> NIRZ NIRZ NIRZ NIRZ NIRZ NIRZ -> TIKT NIRZ TIKT TIKT NIRZ -> MNIW TIKT NIRZ MNIW TIKT MNIW -> KGPX NIRZ TIKT NIRZ NIRZ TIKT -> HRPC NIRZ TIKT -> KGPX -> KGPX TIKT HRPC KGPX KGPX -> ZZXV -> ADOT -> WMJP ZZXV -> ZEZS ZEZS MNIW MNIW MNIW ADOT -> KGPX ZZXV HRPC -> WMJP MNIW ZEZS ZEZS NIRZ TIKT ...
output:
correct
result:
ok single line: 'correct'
Test #22:
score: 0
Accepted
time: 16ms
memory: 4804kb
input:
40000 -> NIRZ NIRZ NIRZ NIRZ NIRZ NIRZ -> TIKT NIRZ TIKT TIKT NIRZ -> MNIW TIKT NIRZ MNIW TIKT MNIW -> KGPX NIRZ TIKT NIRZ NIRZ TIKT -> HRPC NIRZ TIKT -> KGPX -> KGPX TIKT HRPC KGPX KGPX -> ZZXV -> ADOT -> WMJP ZZXV -> ZEZS ZEZS MNIW MNIW MNIW ADOT -> KGPX ZZXV HRPC -> WMJP MNIW ZEZS ZEZS NIRZ TIKT ...
output:
23610
result:
ok single line: '23610'
Test #23:
score: 0
Accepted
time: 29ms
memory: 5220kb
input:
40000 -> WJQI WJQI WJQI WJQI WJQI -> YGUW YGUW YGUW WJQI WJQI -> RIYY YGUW RIYY RIYY YGUW WJQI -> MYGE MYGE WJQI -> MYGE MYGE YGUW RIYY -> WJQI WJQI RIYY -> QNSA YGUW RIYY WJQI WJQI MYGE -> RIYY QNSA -> RLFM RLFM MYGE -> RIYY WJQI -> RIYY RLFM RLFM RLFM -> YMDN WJQI YMDN RLFM -> JTFU JTFU WJQI RIYY ...
output:
correct
result:
ok single line: 'correct'
Test #24:
score: 0
Accepted
time: 13ms
memory: 4476kb
input:
40000 -> WJQI WJQI WJQI WJQI WJQI -> YGUW YGUW YGUW WJQI WJQI -> RIYY YGUW RIYY RIYY YGUW WJQI -> MYGE MYGE WJQI -> MYGE MYGE YGUW RIYY -> WJQI WJQI RIYY -> QNSA YGUW RIYY WJQI WJQI MYGE -> RIYY QNSA -> RLFM RLFM MYGE -> RIYY WJQI -> RIYY RLFM RLFM RLFM -> YMDN WJQI YMDN RLFM -> JTFU JTFU WJQI RIYY ...
output:
19344
result:
ok single line: '19344'
Test #25:
score: 0
Accepted
time: 29ms
memory: 5172kb
input:
40000 -> OLJT OLJT OLJT OLJT OLJT -> PSHS PSHS OLJT PSHS -> KBSL OLJT OLJT KBSL KBSL OLJT -> DHIQ KBSL -> LBOD OLJT PSHS DHIQ OLJT KBSL -> KBSL LBOD OLJT PSHS -> ASPF -> KBSL OLJT LBOD DHIQ LBOD OLJT -> ASPF OLJT LBOD -> DHIQ LBOD LBOD ASPF OLJT PSHS -> LBOD LBOD PSHS DHIQ ASPF -> DIIC LBOD OLJT -> ...
output:
correct
result:
ok single line: 'correct'
Test #26:
score: 0
Accepted
time: 12ms
memory: 4352kb
input:
40000 -> OLJT OLJT OLJT OLJT OLJT -> PSHS PSHS OLJT PSHS -> KBSL OLJT OLJT KBSL KBSL OLJT -> DHIQ KBSL -> LBOD OLJT PSHS DHIQ OLJT KBSL -> KBSL LBOD OLJT PSHS -> ASPF -> KBSL OLJT LBOD DHIQ LBOD OLJT -> ASPF OLJT LBOD -> DHIQ LBOD LBOD ASPF OLJT PSHS -> LBOD LBOD PSHS DHIQ ASPF -> DIIC LBOD OLJT -> ...
output:
18082
result:
ok single line: '18082'
Test #27:
score: 0
Accepted
time: 25ms
memory: 5200kb
input:
40000 -> QRFJ QRFJ QRFJ QRFJ QRFJ -> QRFJ QRFJ QRFJ -> PZFC QRFJ PZFC QRFJ PZFC PZFC -> TXYC -> TXYC QRFJ TXYC -> PZFC TXYC PZFC QRFJ QRFJ -> RRKG -> EVIJ PZFC -> EHGG QRFJ EVIJ EVIJ -> AGBX AGBX -> TXYC -> LIXO -> EVIJ LIXO EVIJ EVIJ LIXO LIXO -> TXYC EVIJ AGBX RRKG EHGG EHGG -> LIXO TXYC EHGG AGBX...
output:
correct
result:
ok single line: 'correct'
Test #28:
score: 0
Accepted
time: 22ms
memory: 4936kb
input:
40000 -> QRFJ QRFJ QRFJ QRFJ QRFJ -> QRFJ QRFJ QRFJ -> PZFC QRFJ PZFC QRFJ PZFC PZFC -> TXYC -> TXYC QRFJ TXYC -> PZFC TXYC PZFC QRFJ QRFJ -> RRKG -> EVIJ PZFC -> EHGG QRFJ EVIJ EVIJ -> AGBX AGBX -> TXYC -> LIXO -> EVIJ LIXO EVIJ EVIJ LIXO LIXO -> TXYC EVIJ AGBX RRKG EHGG EHGG -> LIXO TXYC EHGG AGBX...
output:
31138
result:
ok single line: '31138'
Test #29:
score: 0
Accepted
time: 29ms
memory: 5208kb
input:
40000 -> DRUV DRUV DRUV -> BIYM DRUV DRUV DRUV BIYM DRUV -> DRUV -> KHFC DRUV KHFC BIYM -> EMZL EMZL -> KHFC BIYM BIYM BIYM DRUV KHFC -> XXJM -> EMZL DRUV BIYM XXJM -> EMZL DRUV -> VGTO EMZL BIYM VGTO KHFC -> BIYM XXJM KHFC -> XWOK EMZL XWOK EMZL -> TKLR BIYM -> VGTO BIYM BIYM BIYM BIYM BIYM -> UUCJ...
output:
correct
result:
ok single line: 'correct'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3752kb
input:
40000 -> DRUV DRUV DRUV -> BIYM DRUV DRUV DRUV BIYM DRUV -> DRUV -> KHFC DRUV KHFC BIYM -> EMZL EMZL -> KHFC BIYM BIYM BIYM DRUV KHFC -> XXJM -> EMZL DRUV BIYM XXJM -> EMZL DRUV -> VGTO EMZL BIYM VGTO KHFC -> BIYM XXJM KHFC -> XWOK EMZL XWOK EMZL -> TKLR BIYM -> VGTO BIYM BIYM BIYM BIYM BIYM -> UUCJ...
output:
2525
result:
ok single line: '2525'
Test #31:
score: 0
Accepted
time: 25ms
memory: 5212kb
input:
40000 -> UHYH UHYH UHYH UHYH UHYH UHYH -> EMMQ EMMQ UHYH -> UYBG UYBG UHYH EMMQ UYBG -> UHYH UYBG UHYH UYBG UHYH UYBG -> EMMQ EMMQ UHYH UYBG EMMQ -> EMMQ EMMQ UYBG UHYH -> UURB UHYH UHYH -> QOKB -> UYBG UYBG UHYH EMMQ UHYH UYBG -> EMMQ QOKB QOKB EMMQ EMMQ -> UYBG UYBG UYBG QOKB UURB QOKB -> QOKB QOK...
output:
correct
result:
ok single line: 'correct'
Test #32:
score: 0
Accepted
time: 7ms
memory: 4144kb
input:
40000 -> UHYH UHYH UHYH UHYH UHYH UHYH -> EMMQ EMMQ UHYH -> UYBG UYBG UHYH EMMQ UYBG -> UHYH UYBG UHYH UYBG UHYH UYBG -> EMMQ EMMQ UHYH UYBG EMMQ -> EMMQ EMMQ UYBG UHYH -> UURB UHYH UHYH -> QOKB -> UYBG UYBG UHYH EMMQ UHYH UYBG -> EMMQ QOKB QOKB EMMQ EMMQ -> UYBG UYBG UYBG QOKB UURB QOKB -> QOKB QOK...
output:
10551
result:
ok single line: '10551'
Test #33:
score: 0
Accepted
time: 25ms
memory: 5144kb
input:
40000 -> EBTP EBTP EBTP EBTP EBTP -> EBTP EBTP EBTP EBTP EBTP -> PSJM -> EBTP PSJM -> XBVF PSJM XBVF -> PSJM EBTP EBTP -> IXAI -> SSXB IXAI EBTP SSXB -> XBVF -> PSJM XBVF IXAI XBVF IXAI EBTP -> ITRW SSXB XBVF ITRW EBTP -> SSXB SSXB EBTP -> RUPS EBTP EBTP -> ZXSK SSXB XBVF -> PSJM PSJM RUPS EBTP XBVF...
output:
correct
result:
ok single line: 'correct'
Test #34:
score: 0
Accepted
time: 17ms
memory: 4596kb
input:
40000 -> EBTP EBTP EBTP EBTP EBTP -> EBTP EBTP EBTP EBTP EBTP -> PSJM -> EBTP PSJM -> XBVF PSJM XBVF -> PSJM EBTP EBTP -> IXAI -> SSXB IXAI EBTP SSXB -> XBVF -> PSJM XBVF IXAI XBVF IXAI EBTP -> ITRW SSXB XBVF ITRW EBTP -> SSXB SSXB EBTP -> RUPS EBTP EBTP -> ZXSK SSXB XBVF -> PSJM PSJM RUPS EBTP XBVF...
output:
25300
result:
ok single line: '25300'
Test #35:
score: 0
Accepted
time: 29ms
memory: 5284kb
input:
40000 -> KODI -> KODI -> TPCA TPCA KODI KODI TPCA KODI -> JBPS TPCA TPCA JBPS KODI TPCA -> JBPS JBPS KODI JBPS KODI JBPS -> DEOB DEOB KODI JBPS -> KODI DEOB KODI TPCA -> XTJY TPCA -> CYWD CYWD -> JBPS JBPS TPCA TPCA CYWD -> ZPYK CYWD DEOB KODI DEOB TPCA -> YQQH KODI ZPYK -> HRAI XTJY -> ZPYK HRAI KO...
output:
correct
result:
ok single line: 'correct'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
40000 -> KODI -> KODI -> TPCA TPCA KODI KODI TPCA KODI -> JBPS TPCA TPCA JBPS KODI TPCA -> JBPS JBPS KODI JBPS KODI JBPS -> DEOB DEOB KODI JBPS -> KODI DEOB KODI TPCA -> XTJY TPCA -> CYWD CYWD -> JBPS JBPS TPCA TPCA CYWD -> ZPYK CYWD DEOB KODI DEOB TPCA -> YQQH KODI ZPYK -> HRAI XTJY -> ZPYK HRAI KO...
output:
1411
result:
ok single line: '1411'
Test #37:
score: 0
Accepted
time: 29ms
memory: 5224kb
input:
40000 -> WBKE WBKE WBKE WBKE WBKE -> WBKE WBKE WBKE WBKE WBKE -> MEZY WBKE MEZY WBKE MEZY WBKE -> WBKE -> NXXU WBKE -> ZLGF WBKE MEZY -> MEZY ZLGF -> WHWE WBKE NXXU -> AWJT WBKE WBKE AWJT -> USRT NXXU MEZY -> AWJT NXXU NXXU -> ZLGF -> NXXU -> QGMM NXXU -> QGMM MEZY NXXU -> ZEBV AWJT ZLGF -> YXZS USR...
output:
correct
result:
ok single line: 'correct'
Test #38:
score: 0
Accepted
time: 20ms
memory: 4824kb
input:
40000 -> WBKE WBKE WBKE WBKE WBKE -> WBKE WBKE WBKE WBKE WBKE -> MEZY WBKE MEZY WBKE MEZY WBKE -> WBKE -> NXXU WBKE -> ZLGF WBKE MEZY -> MEZY ZLGF -> WHWE WBKE NXXU -> AWJT WBKE WBKE AWJT -> USRT NXXU MEZY -> AWJT NXXU NXXU -> ZLGF -> NXXU -> QGMM NXXU -> QGMM MEZY NXXU -> ZEBV AWJT ZLGF -> YXZS USR...
output:
29723
result:
ok single line: '29723'
Test #39:
score: 0
Accepted
time: 29ms
memory: 5172kb
input:
40000 -> NGNX NGNX -> WNNY WNNY NGNX WNNY NGNX -> WNNY NGNX NGNX WNNY WNNY NGNX -> SZRF -> JRLG SZRF JRLG JRLG -> DBAT JRLG JRLG SZRF -> DBAT NGNX SZRF SZRF -> IMBG JRLG -> OLPY NGNX IMBG DBAT IMBG -> WNNY -> QUKX IMBG SZRF IMBG SZRF JRLG -> IMBG WNNY QUKX QUKX -> JRLG JRLG QUKX NGNX -> DBAT OLPY JR...
output:
correct
result:
ok single line: 'correct'
Test #40:
score: 0
Accepted
time: 4ms
memory: 3984kb
input:
40000 -> NGNX NGNX -> WNNY WNNY NGNX WNNY NGNX -> WNNY NGNX NGNX WNNY WNNY NGNX -> SZRF -> JRLG SZRF JRLG JRLG -> DBAT JRLG JRLG SZRF -> DBAT NGNX SZRF SZRF -> IMBG JRLG -> OLPY NGNX IMBG DBAT IMBG -> WNNY -> QUKX IMBG SZRF IMBG SZRF JRLG -> IMBG WNNY QUKX QUKX -> JRLG JRLG QUKX NGNX -> DBAT OLPY JR...
output:
6711
result:
ok single line: '6711'
Test #41:
score: 0
Accepted
time: 29ms
memory: 5372kb
input:
40000 -> PZVY PZVY PZVY PZVY -> OMHV OMHV OMHV PZVY OMHV OMHV -> QHWT QHWT -> OMHV PZVY OMHV QHWT -> OMHV -> GAIX QHWT PZVY PZVY PZVY GAIX -> TKUN OMHV QHWT -> GAIX GAIX TKUN PZVY GAIX -> TKUN PZVY -> TKUN OMHV QHWT -> OMHV TKUN GAIX PZVY OMHV -> UHZM OMHV -> OMHV TKUN UHZM UHZM -> PZVY PZVY GAIX GA...
output:
correct
result:
ok single line: 'correct'
Test #42:
score: 0
Accepted
time: 11ms
memory: 4508kb
input:
40000 -> PZVY PZVY PZVY PZVY -> OMHV OMHV OMHV PZVY OMHV OMHV -> QHWT QHWT -> OMHV PZVY OMHV QHWT -> OMHV -> GAIX QHWT PZVY PZVY PZVY GAIX -> TKUN OMHV QHWT -> GAIX GAIX TKUN PZVY GAIX -> TKUN PZVY -> TKUN OMHV QHWT -> OMHV TKUN GAIX PZVY OMHV -> UHZM OMHV -> OMHV TKUN UHZM UHZM -> PZVY PZVY GAIX GA...
output:
17129
result:
ok single line: '17129'
Test #43:
score: 0
Accepted
time: 31ms
memory: 5152kb
input:
40000 -> GKLL GKLL GKLL GKLL GKLL -> GZGP -> GZGP GZGP GZGP GZGP GZGP GZGP -> PHHH GZGP GKLL PHHH GKLL PHHH -> LBTV GZGP LBTV LBTV GZGP LBTV -> PHHH -> CQLH PHHH CQLH LBTV -> DYLR GZGP CQLH GZGP -> PHHH PHHH -> HIEI GZGP -> CVOD GKLL -> DYLR GKLL DYLR CQLH -> LWET CVOD GKLL LBTV HIEI GKLL -> CPEF PH...
output:
correct
result:
ok single line: 'correct'
Test #44:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
40000 -> GKLL GKLL GKLL GKLL GKLL -> GZGP -> GZGP GZGP GZGP GZGP GZGP GZGP -> PHHH GZGP GKLL PHHH GKLL PHHH -> LBTV GZGP LBTV LBTV GZGP LBTV -> PHHH -> CQLH PHHH CQLH LBTV -> DYLR GZGP CQLH GZGP -> PHHH PHHH -> HIEI GZGP -> CVOD GKLL -> DYLR GKLL DYLR CQLH -> LWET CVOD GKLL LBTV HIEI GKLL -> CPEF PH...
output:
495
result:
ok single line: '495'
Test #45:
score: 0
Accepted
time: 27ms
memory: 5284kb
input:
40000 -> APVY APVY APVY APVY APVY -> APVY APVY APVY APVY APVY -> APVY APVY APVY APVY -> SPXX APVY -> APVY APVY SPXX -> LJZC SPXX APVY LJZC -> GBWX -> GBWX LJZC GBWX GBWX -> PPVA SPXX PPVA LJZC PPVA APVY -> TWYR LJZC TWYR GBWX TWYR -> TWYR LJZC APVY TWYR -> APVY -> BVKU SPXX PPVA BVKU PPVA APVY -> OW...
output:
correct
result:
ok single line: 'correct'
Test #46:
score: 0
Accepted
time: 11ms
memory: 4212kb
input:
40000 -> APVY APVY APVY APVY APVY -> APVY APVY APVY APVY APVY -> APVY APVY APVY APVY -> SPXX APVY -> APVY APVY SPXX -> LJZC SPXX APVY LJZC -> GBWX -> GBWX LJZC GBWX GBWX -> PPVA SPXX PPVA LJZC PPVA APVY -> TWYR LJZC TWYR GBWX TWYR -> TWYR LJZC APVY TWYR -> APVY -> BVKU SPXX PPVA BVKU PPVA APVY -> OW...
output:
16814
result:
ok single line: '16814'
Test #47:
score: 0
Accepted
time: 28ms
memory: 5200kb
input:
40000 -> LATL LATL LATL LATL LATL -> LATL LATL LATL LATL LATL -> LATL LATL LATL LATL -> LATL LATL LATL LATL LATL -> LATL LATL LATL -> BTPL LATL LATL LATL BTPL LATL -> BTPL BTPL BTPL -> LATL -> QOWY QOWY BTPL LATL LATL -> TZDX QOWY QOWY -> OLGX BTPL LATL OLGX TZDX -> QOWY -> OLGX BTPL OLGX LATL LATL ...
output:
correct
result:
ok single line: 'correct'
Test #48:
score: 0
Accepted
time: 2ms
memory: 4008kb
input:
40000 -> LATL LATL LATL LATL LATL -> LATL LATL LATL LATL LATL -> LATL LATL LATL LATL -> LATL LATL LATL LATL LATL -> LATL LATL LATL -> BTPL LATL LATL LATL BTPL LATL -> BTPL BTPL BTPL -> LATL -> QOWY QOWY BTPL LATL LATL -> TZDX QOWY QOWY -> OLGX BTPL LATL OLGX TZDX -> QOWY -> OLGX BTPL OLGX LATL LATL ...
output:
3180
result:
ok single line: '3180'
Test #49:
score: 0
Accepted
time: 29ms
memory: 5160kb
input:
40000 -> NODD NODD -> NODD -> VRMH VRMH NODD NODD NODD -> VRMH VRMH -> AGRW AGRW VRMH VRMH AGRW VRMH -> VRMH VRMH NODD VRMH -> VRMH AGRW AGRW NODD AGRW -> NODD NODD VRMH VRMH VRMH AGRW -> AGRW -> NODD NODD NODD -> NODD -> ZBQK NODD AGRW -> NODD AGRW NODD AGRW -> KQWD ZBQK KQWD KQWD -> NODD ZBQK VRMH...
output:
correct
result:
ok single line: 'correct'
Test #50:
score: 0
Accepted
time: 14ms
memory: 4416kb
input:
40000 -> NODD NODD -> NODD -> VRMH VRMH NODD NODD NODD -> VRMH VRMH -> AGRW AGRW VRMH VRMH AGRW VRMH -> VRMH VRMH NODD VRMH -> VRMH AGRW AGRW NODD AGRW -> NODD NODD VRMH VRMH VRMH AGRW -> AGRW -> NODD NODD NODD -> NODD -> ZBQK NODD AGRW -> NODD AGRW NODD AGRW -> KQWD ZBQK KQWD KQWD -> NODD ZBQK VRMH...
output:
20872
result:
ok single line: '20872'
Test #51:
score: 0
Accepted
time: 30ms
memory: 5268kb
input:
40000 -> UMMH UMMH UMMH UMMH -> UMMH UMMH UMMH -> SITW UMMH SITW SITW UMMH -> UMMH UMMH SITW SITW UMMH SITW -> SITW SITW SITW UMMH SITW SITW -> UMMH SITW -> LLIB LLIB SITW LLIB LLIB -> XWSS SITW UMMH LLIB -> XWSS -> SITW XWSS -> CNDL XWSS -> LLIB CNDL CNDL UMMH UMMH -> AMQM LLIB XWSS SITW UMMH -> LL...
output:
correct
result:
ok single line: 'correct'
Test #52:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
40000 -> UMMH UMMH UMMH UMMH -> UMMH UMMH UMMH -> SITW UMMH SITW SITW UMMH -> UMMH UMMH SITW SITW UMMH SITW -> SITW SITW SITW UMMH SITW SITW -> UMMH SITW -> LLIB LLIB SITW LLIB LLIB -> XWSS SITW UMMH LLIB -> XWSS -> SITW XWSS -> CNDL XWSS -> LLIB CNDL CNDL UMMH UMMH -> AMQM LLIB XWSS SITW UMMH -> LL...
output:
1998
result:
ok single line: '1998'
Test #53:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
1 A -> A
output:
1
result:
ok single line: '1'
Test #54:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
2 A -> A B -> A
output:
1
result:
ok single line: '1'
Test #55:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
3 -> A -> B A B -> A
output:
correct
result:
ok single line: 'correct'
Test #56:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
2 -> A A A -> B
output:
correct
result:
ok single line: 'correct'