QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#622831 | #5307. Subgraph Isomorphism | duduFreire | TL | 399ms | 11864kb | C++20 | 2.9kb | 2024-10-09 06:36:52 | 2024-10-09 06:36:54 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(int i=(int)(a); i < (int)(b);i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl
#define esp ' '
#define pii pair<int,int>
#define vi vector<int>
#define sz(x) ((int)(x).size())
using namespace std;
constexpr int oo = 0x3f3f3f3f3f3f3f3f;
constexpr int M = 23785125;
constexpr int mxI = 36;
constexpr ll MOD1 = 21412641264812894;
constexpr ll MOD2 = 17841234164112412;
struct DSU {
vi p, rnk;
DSU(int n) : p(n), rnk(n,0) {
iota(all(p),0);
}
int find(int x) {
return p[x] == x ? x : p[x]=find(p[x]);
}
bool merge(int a, int b) {
a=find(a);
b=find(b);
if (a == b) return false;
if (rnk[a] > rnk[b]) swap(a,b);
rnk[b] += rnk[a]==rnk[b];
p[a]=b;
return true;
}
};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve() {
int n,m;cin>>n>>m;
vector<pair<int,int>> edges(m);
rep(i,0,m) {
int a,b;cin>>a>>b;a--;b--;
edges[i]={a,b};
}
if (m == n-1) {
cout << "YES\n";
return;
}
auto hash=[&](auto self, vector<vi>& g, int a, int p=-1) -> ll{
vector<ll> sons;
for (auto b : g[a]) if (b != p) {
sons.pb(self(self, g, b, a));
}
sort(all(sons));
ll po=418417123;
ll ans=1958473849193;
for (auto x : sons) {
ans += po * x;
if (ans >= 412412355) ans -= 36162378;
//ans %= MOD1;
po *= M;
//po %= MOD1;
}
return ans;
};
auto test=[&](vector<vi>& g) {
vi szs(n,0), ps(n);
auto dfs1=[&](auto self, int a, int p) -> void{
ps[a] = p;
szs[a] = 1;
for (auto b : g[a]) if (b != p) {
self(self, b, a);
szs[a] += szs[b];
}
};
dfs1(dfs1, 0,-1);
auto ctrd=[&](int a) {
if (2*(n - szs[a]) > n) return false;
for (auto b : g[a]) if (b != ps[a]) {
if (2*szs[b] > n) return false;
}
return true;
};
vi ctrds;
rep(a,0,n) {
if (ctrd(a)) ctrds.pb(a);
}
vector<ll> ans;
for (auto x : ctrds) ans.eb(hash(hash, g, x));
return ans;
};
auto is_eq = [&](vector<ll> a, vector<ll> b) {
if (sz(a) != sz(b)) return false;
sort(all(a));
sort(all(b));
return a == b;
};
DSU dsu(n);
auto dfstree=[&](vector<vi>& tree) {
iota(all(dsu.p), 0);
memset(&dsu.rnk[0], 0, n*sizeof(int));
tree.assign(n, vi());
shuffle(all(edges), rng);
for (auto [a,b] : edges) {
if (!dsu.merge(a,b)) continue;
tree[a].pb(b);
tree[b].pb(a);
}
};
vector<vi> tree(n);
dfstree(tree);
auto hashs = test(tree);
rep(_, 1, mxI) {
dfstree(tree);
auto hashc = test(tree);
if (!is_eq(hashc, hashs)) {
cout << "NO\n";
return;
}
}
cout << "YES\n";
}
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);
int t=1;
cin>>t;
while(t--) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3656kb
input:
4 7 6 1 2 2 3 3 4 4 5 5 6 3 7 3 3 1 2 2 3 3 1 5 5 1 2 2 3 3 4 4 1 1 5 1 0
output:
YES YES NO YES
result:
ok 4 token(s): yes count is 3, no count is 1
Test #2:
score: 0
Accepted
time: 120ms
memory: 3620kb
input:
33192 2 1 1 2 3 2 1 3 2 3 3 3 1 2 1 3 2 3 4 3 1 4 2 4 3 4 4 3 1 3 1 4 2 4 4 4 1 3 1 4 2 4 3 4 4 4 1 3 1 4 2 3 2 4 4 5 1 3 1 4 2 3 2 4 3 4 4 6 1 2 1 3 1 4 2 3 2 4 3 4 5 4 1 5 2 5 3 5 4 5 5 4 1 4 1 5 2 5 3 5 5 5 1 4 1 5 2 5 3 5 4 5 5 5 1 4 1 5 2 4 3 5 4 5 5 5 1 4 1 5 2 4 2 5 3 5 5 6 1 4 1 5 2 4 2 5 3 ...
output:
YES YES YES YES YES NO YES NO NO YES YES NO NO NO NO NO NO YES NO NO NO NO YES NO NO NO NO NO NO NO YES YES NO YES YES NO NO NO YES NO NO NO NO NO YES NO NO NO YES NO NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO...
result:
ok 33192 token(s): yes count is 58, no count is 33134
Test #3:
score: 0
Accepted
time: 144ms
memory: 3608kb
input:
40000 9 24 1 4 1 6 1 7 1 9 2 5 2 7 2 8 2 9 3 5 3 7 3 8 3 9 4 6 4 8 4 9 5 6 5 8 5 9 6 7 6 8 6 9 7 8 7 9 8 9 9 21 1 4 1 6 1 7 1 8 2 5 2 7 2 8 2 9 3 5 3 7 3 9 4 6 4 8 4 9 5 6 5 9 6 7 6 8 6 9 7 8 8 9 9 21 1 4 1 6 1 7 1 8 2 5 2 7 2 8 2 9 3 5 3 7 3 9 4 6 4 8 4 9 5 6 5 9 6 7 6 8 6 9 7 8 7 9 9 22 1 4 1 6 1 ...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 40000 token(s): yes count is 0, no count is 40000
Test #4:
score: 0
Accepted
time: 140ms
memory: 3652kb
input:
40000 9 16 1 4 1 6 1 8 1 9 2 5 2 7 2 8 2 9 3 6 3 7 4 7 5 8 6 9 7 8 7 9 8 9 9 16 1 4 1 6 1 8 1 9 2 5 2 7 2 8 2 9 3 6 3 7 4 7 5 8 5 9 7 8 7 9 8 9 9 16 1 4 1 6 1 8 1 9 2 5 2 7 2 8 2 9 3 6 3 7 4 7 5 8 5 9 6 9 7 8 8 9 9 16 1 4 1 6 1 8 1 9 2 5 2 7 2 8 2 9 3 6 3 7 4 7 5 8 5 9 6 9 7 8 7 9 9 17 1 4 1 6 1 8 1...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 40000 token(s): yes count is 0, no count is 40000
Test #5:
score: 0
Accepted
time: 138ms
memory: 3612kb
input:
40000 9 17 1 5 1 6 1 7 1 8 2 5 2 7 2 9 3 6 3 8 3 9 4 7 4 8 4 9 5 7 5 8 5 9 6 9 9 18 1 5 1 6 1 7 1 8 2 5 2 7 2 9 3 6 3 8 3 9 4 7 4 8 4 9 5 7 5 8 5 9 6 9 8 9 9 18 1 5 1 6 1 7 1 8 2 5 2 7 2 9 3 6 3 8 3 9 4 7 4 8 4 9 5 7 5 8 5 9 6 9 7 9 9 19 1 5 1 6 1 7 1 8 2 5 2 7 2 9 3 6 3 8 3 9 4 7 4 8 4 9 5 7 5 8 5 ...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 40000 token(s): yes count is 0, no count is 40000
Test #6:
score: 0
Accepted
time: 137ms
memory: 3696kb
input:
40000 9 17 1 5 1 6 1 7 1 8 2 6 2 7 2 8 2 9 3 7 3 9 4 9 5 8 6 7 6 8 6 9 7 9 8 9 9 16 1 5 1 6 1 7 1 8 2 6 2 7 2 8 2 9 3 7 3 9 4 9 5 8 5 9 6 7 6 8 8 9 9 16 1 5 1 6 1 7 1 8 2 6 2 7 2 8 2 9 3 7 3 9 4 9 5 8 5 9 6 7 6 8 7 9 9 17 1 5 1 6 1 7 1 8 2 6 2 7 2 8 2 9 3 7 3 9 4 9 5 8 5 9 6 7 6 8 7 9 8 9 9 17 1 5 1...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 40000 token(s): yes count is 0, no count is 40000
Test #7:
score: 0
Accepted
time: 132ms
memory: 3720kb
input:
40000 9 15 1 5 1 8 1 9 2 6 2 7 2 9 3 6 3 7 4 7 4 8 4 9 5 8 6 9 7 9 8 9 9 13 1 5 1 8 1 9 2 6 2 7 2 9 3 6 3 7 4 7 4 8 4 9 5 8 5 9 9 14 1 5 1 8 1 9 2 6 2 7 2 9 3 6 3 7 4 7 4 8 4 9 5 8 5 9 8 9 9 14 1 5 1 8 1 9 2 6 2 7 2 9 3 6 3 7 4 7 4 8 4 9 5 8 5 9 7 9 9 15 1 5 1 8 1 9 2 6 2 7 2 9 3 6 3 7 4 7 4 8 4 9 5...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 40000 token(s): yes count is 1, no count is 39999
Test #8:
score: 0
Accepted
time: 125ms
memory: 3600kb
input:
40000 9 8 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 8 1 8 1 9 2 9 3 9 4 9 5 9 6 9 7 9 9 9 1 8 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 8 1 8 2 8 3 9 4 9 5 9 6 9 7 9 8 9 9 8 1 8 1 9 2 8 3 9 4 9 5 9 6 9 7 9 9 9 1 8 1 9 2 8 3 9 4 9 5 9 6 9 7 9 8 9 9 9 1 8 1 9 2 8 2 9 3 9 4 9 5 9 6 9 7 9 9 10 1 8 1 9 2 8 2 9 3 9 4 9 5...
output:
YES YES NO YES YES NO NO NO YES YES NO NO NO NO NO YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES NO NO YES NO YES NO NO NO NO NO NO NO YES NO YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES NO YES NO NO NO N...
result:
ok 40000 token(s): yes count is 50, no count is 39950
Test #9:
score: 0
Accepted
time: 43ms
memory: 3752kb
input:
1393 25 100 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 3 2 4 2 5 2 10 2 11 2 12 2 13 3 4 3 5 3 14 3 17 3 18 3 19 4 5 4 15 4 20 4 22 4 23 5 16 5 21 5 24 5 25 6 7 6 8 6 9 6 10 6 14 6 15 6 16 7 8 7 9 7 11 7 17 7 20 7 21 8 9 8 12 8 18 8 22 8 24 9 13 9 19 9 23 9 25 10 11 10 12 10 13 10 14 10 15 10 16 11 12 11 13 ...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 1393 token(s): yes count is 0, no count is 1393
Test #10:
score: 0
Accepted
time: 84ms
memory: 3608kb
input:
3000 35 280 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 2 3 2 4 2 5 2 6 2 7 2 8 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 3 11 3 12 3 13 3 16 3 17 3 18 3 21 3 24 3 25 3 26 3 27 3 32 3 34 3 35 4 10 4 14 4 15 4 16 4 17 4 19 4 20 4 24 4 25 4 26 4 28 4 31 4 33 4 35 5 9 5 1...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 3000 token(s): yes count is 0, no count is 3000
Test #11:
score: 0
Accepted
time: 374ms
memory: 11864kb
input:
30 28171 28170 2482 5158 15414 17513 7825 17196 10171 8545 8850 13596 3314 9296 5490 15625 18905 9569 24135 6453 360 718 65 27875 13734 20008 20072 4447 23395 24852 11440 1818 20672 13049 13770 6079 19115 24044 22134 24300 15787 3053 6462 6652 3200 14184 20621 629 1328 5200 7181 17707 4515 18911 249...
output:
YES NO NO NO YES YES NO NO NO NO YES NO NO NO YES YES YES NO YES NO NO NO NO NO YES YES NO NO YES YES
result:
ok 30 token(s): yes count is 12, no count is 18
Test #12:
score: 0
Accepted
time: 399ms
memory: 11556kb
input:
30 3658 3658 1673 1805 115 1360 145 1722 3398 2869 700 3578 2145 60 3563 2682 2957 307 2443 1048 3581 2555 2368 2336 1023 3041 664 412 1950 552 3425 1162 3159 3296 1373 1763 1336 3591 1119 1992 1912 354 3573 3124 1351 1022 3047 2879 2521 1939 1683 1679 1070 1259 1342 1637 732 2576 2167 3067 2742 514...
output:
NO NO YES YES NO YES YES NO NO NO YES NO NO NO YES NO YES YES NO YES NO YES NO YES NO YES YES NO NO NO
result:
ok 30 token(s): yes count is 13, no count is 17
Test #13:
score: 0
Accepted
time: 285ms
memory: 11212kb
input:
30 6200 6199 2543 3295 1003 4780 4627 4563 5620 660 1731 3047 1198 3343 3419 4710 2488 3843 3722 4576 752 3212 5313 4025 4612 286 1967 1397 36 2212 1206 928 4689 1268 2831 4376 4334 3028 1040 1514 5636 5331 4257 571 5182 5007 1629 208 2345 3406 5280 4999 2607 2254 6192 1403 5075 3889 3389 5294 3682 ...
output:
YES NO YES YES YES NO YES NO NO NO YES NO NO YES NO YES NO NO YES YES YES NO NO YES YES YES NO YES NO YES
result:
ok 30 token(s): yes count is 16, no count is 14
Test #14:
score: 0
Accepted
time: 349ms
memory: 11640kb
input:
30 14491 14490 6052 10994 13301 461 1336 9631 10722 4121 9829 5812 11883 5039 4854 6739 4064 11033 466 6698 2959 4374 3041 3663 5616 3289 458 788 4018 8915 13689 2763 14153 14146 2336 9011 7827 11114 9235 13235 4091 5135 8099 10920 4359 13623 10194 870 3222 11124 13620 2624 4477 7638 12926 10795 506...
output:
YES YES NO NO YES NO NO NO YES NO YES NO YES YES YES YES NO NO YES YES YES YES YES YES YES YES NO YES NO NO
result:
ok 30 token(s): yes count is 18, no count is 12
Test #15:
score: 0
Accepted
time: 298ms
memory: 11068kb
input:
30 100000 99999 58634 53166 60069 39545 82578 88227 56874 85747 22905 28646 92672 64752 22373 59305 22541 59348 44095 65942 4988 67515 10343 77755 60473 69842 23600 65125 30620 9705 23682 88606 90443 30376 64660 28469 49987 74473 95538 6848 57849 92719 41776 11339 34932 41927 53269 36288 27451 77680...
output:
YES NO YES NO YES NO YES NO YES NO NO YES NO NO YES YES NO NO NO YES YES NO NO NO NO NO NO NO YES YES
result:
ok 30 token(s): yes count is 12, no count is 18
Test #16:
score: 0
Accepted
time: 232ms
memory: 11656kb
input:
30 28822 28821 18849 2213 3904 10406 22000 14733 3382 11686 18120 2209 16720 21313 27796 11273 2151 1627 14221 1730 28679 13010 13611 8540 8923 13036 14093 25113 28268 1341 22450 5687 24407 28379 28185 19130 9949 4590 19825 24477 24266 21368 15658 20039 19834 22900 10711 27768 21931 21505 701 5260 2...
output:
YES NO YES YES NO YES YES YES NO NO NO NO NO NO YES NO NO YES YES YES NO NO YES NO NO YES YES NO NO YES
result:
ok 30 token(s): yes count is 14, no count is 16
Test #17:
score: 0
Accepted
time: 181ms
memory: 11460kb
input:
30 94155 94155 59782 9369 85417 55440 49151 38561 70569 2997 58372 92455 55440 13968 23987 25454 31693 59782 28401 47143 70435 87698 29557 80207 71824 24642 52316 53847 52316 49058 26005 29924 42139 19301 57171 76189 41506 59782 41871 88927 2997 10080 41910 83200 52724 3425 55302 18910 72572 45110 6...
output:
NO YES NO YES YES NO YES NO NO YES YES NO YES NO YES NO YES YES NO YES YES YES NO NO YES NO NO NO NO NO
result:
ok 30 token(s): yes count is 14, no count is 16
Test #18:
score: 0
Accepted
time: 287ms
memory: 3948kb
input:
100000 8 8 7 6 2 8 4 2 7 1 4 3 7 2 6 3 5 6 19 18 7 19 17 10 16 2 1 17 9 2 13 18 8 13 1 6 2 5 5 3 14 5 15 7 2 13 13 7 2 4 2 12 11 7 13 6 36 35 32 14 3 19 9 27 31 20 3 13 3 20 7 8 20 6 28 33 24 5 17 20 12 20 11 24 18 16 25 20 10 30 36 16 15 3 2 16 21 28 21 24 24 12 34 25 17 1 11 2 6 27 29 7 26 20 5 23...
output:
NO YES YES YES YES YES NO YES YES NO NO YES YES NO YES YES YES YES YES NO YES YES YES YES YES YES YES NO YES NO YES YES NO YES YES YES YES YES YES YES YES NO YES NO YES YES YES NO YES YES YES NO NO YES YES YES NO YES YES YES NO NO YES YES NO YES NO NO YES NO YES NO YES NO NO YES YES YES YES YES YES ...
result:
ok 100000 token(s): yes count is 62089, no count is 37911
Test #19:
score: 0
Accepted
time: 307ms
memory: 3716kb
input:
100000 4 4 4 2 1 4 2 3 3 1 5 4 4 1 1 5 2 3 2 5 8 7 8 3 3 7 6 4 1 5 4 8 5 2 1 6 5 5 3 1 2 4 3 5 5 4 4 3 2 1 2 1 2 1 1 2 21 20 1 21 13 18 17 13 19 4 19 1 16 5 17 20 2 9 14 9 8 12 6 2 9 15 7 11 13 19 11 18 6 10 4 16 3 9 5 12 15 11 2 1 2 1 16 16 6 9 9 1 11 2 1 3 13 6 7 12 12 3 4 16 11 7 10 15 11 16 5 16...
output:
YES YES YES NO YES YES YES YES NO YES NO YES YES NO NO YES YES NO YES NO YES YES NO NO NO YES YES YES YES NO YES YES YES YES NO YES NO NO YES NO YES YES YES YES NO NO NO YES NO YES NO YES YES YES YES YES YES YES NO YES NO YES YES YES YES YES YES NO NO YES YES YES YES YES YES NO NO YES YES NO NO YES ...
result:
ok 100000 token(s): yes count is 63111, no count is 36889
Test #20:
score: 0
Accepted
time: 316ms
memory: 3680kb
input:
100000 7 7 1 2 6 2 3 7 4 2 4 5 5 7 3 1 13 12 13 9 3 8 3 11 4 10 7 10 4 8 5 9 7 1 2 11 6 12 13 2 12 1 3 3 2 3 1 3 1 2 4 3 1 3 4 2 1 4 17 17 7 5 17 4 12 5 6 7 13 4 11 14 2 3 10 17 13 3 16 9 8 2 6 17 9 10 11 15 15 16 10 1 8 1 3 2 3 2 3 1 8 8 7 6 1 3 2 3 4 8 8 2 5 4 6 4 5 1 3 2 2 3 1 3 2 1 2 1 2 1 2 1 1...
output:
NO YES YES YES NO YES NO YES YES YES YES YES NO YES NO NO YES NO YES NO YES NO YES YES YES YES YES NO YES YES YES YES NO NO YES YES YES YES YES YES YES NO YES YES YES NO YES NO NO NO NO NO YES NO YES NO YES NO NO YES YES YES YES NO NO NO YES NO YES YES YES NO NO YES YES YES NO YES YES NO YES YES YES...
result:
ok 100000 token(s): yes count is 63673, no count is 36327
Test #21:
score: 0
Accepted
time: 316ms
memory: 3776kb
input:
100000 2 1 2 1 26 25 18 23 26 5 16 8 23 5 12 13 15 24 17 24 6 12 2 9 4 13 9 17 14 11 14 20 20 4 8 3 1 10 21 19 3 1 25 10 22 7 7 15 11 22 6 21 16 26 18 2 2 1 2 1 18 17 11 13 17 8 7 1 11 12 13 16 6 4 1 3 17 14 6 16 9 15 7 2 10 5 3 4 15 8 18 14 9 12 5 2 37 36 31 36 29 28 25 5 22 29 22 35 7 23 33 5 25 2...
output:
YES YES YES YES YES YES NO YES YES NO NO NO NO NO NO YES NO NO YES NO NO YES YES YES YES YES YES NO YES NO NO YES YES YES YES YES YES YES YES YES YES NO NO YES YES YES YES YES NO YES YES YES YES YES YES NO YES YES YES YES YES YES NO YES NO YES NO NO NO YES YES YES YES YES YES NO YES NO YES NO YES YE...
result:
ok 100000 token(s): yes count is 63794, no count is 36206
Test #22:
score: 0
Accepted
time: 238ms
memory: 3704kb
input:
100000 5 4 1 5 2 1 3 1 4 1 33 32 33 16 16 21 28 29 16 1 16 23 14 16 13 16 16 19 2 16 32 16 16 22 28 16 9 23 2 5 16 24 3 17 16 25 3 26 16 3 20 23 16 12 8 28 16 31 23 10 6 3 11 23 30 28 3 4 16 7 18 23 27 16 3 15 2 1 1 2 3 2 1 3 3 2 5 5 3 1 1 4 5 3 5 1 1 2 5 4 5 2 5 4 5 3 1 5 25 25 17 24 16 10 24 16 24...
output:
YES YES YES YES NO YES NO YES NO YES YES NO YES YES NO NO YES YES NO NO YES NO NO NO YES YES YES YES YES NO YES NO NO NO NO YES YES NO NO NO YES NO NO NO NO NO YES NO NO NO NO YES NO YES NO YES YES YES YES YES YES NO YES YES NO NO YES YES NO NO YES NO YES NO NO YES YES YES YES YES YES NO NO YES YES ...
result:
ok 100000 token(s): yes count is 60664, no count is 39336
Test #23:
score: 0
Accepted
time: 235ms
memory: 3712kb
input:
100000 22 22 18 20 18 6 18 11 18 12 11 5 19 18 5 18 9 18 18 1 15 18 17 18 18 22 16 18 18 4 10 18 7 18 13 18 2 18 18 21 8 18 3 18 14 18 14 13 6 13 6 10 6 11 6 5 4 6 7 6 3 6 6 2 12 6 6 9 8 6 14 6 1 6 49 48 29 1 29 45 29 42 29 11 24 29 27 29 29 2 29 17 29 10 29 41 26 29 29 3 29 28 29 35 14 24 29 43 34 ...
output:
NO YES YES YES YES NO YES YES NO YES NO NO YES YES YES YES NO YES YES YES YES NO YES NO YES YES YES YES YES NO YES NO YES NO NO NO NO YES YES NO NO NO YES YES YES YES NO YES YES NO NO YES YES YES NO YES YES NO YES YES YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES YES YES YES NO YES YES Y...
result:
ok 100000 token(s): yes count is 60375, no count is 39625
Test #24:
score: 0
Accepted
time: 227ms
memory: 3716kb
input:
100000 10 10 6 8 6 7 8 3 2 8 4 8 10 8 9 8 5 8 8 1 7 8 39 38 39 25 26 39 2 39 12 39 14 39 35 39 17 39 39 9 39 31 5 39 37 39 39 27 1 39 10 39 39 38 29 39 15 39 39 18 13 39 24 39 39 19 32 39 39 3 39 8 36 39 39 28 39 11 39 21 39 30 39 34 39 22 4 39 39 7 39 23 16 39 33 39 39 20 39 6 8 8 2 4 4 8 6 4 1 4 4...
output:
NO YES NO NO NO YES YES NO YES NO YES NO NO YES YES NO NO YES YES YES YES YES YES NO NO NO NO YES YES YES NO NO YES YES NO YES NO NO YES YES YES NO YES NO YES YES YES YES YES YES NO NO NO YES NO YES YES YES YES YES NO NO NO YES NO YES YES NO YES NO NO YES NO YES NO NO YES YES NO YES YES NO YES YES N...
result:
ok 100000 token(s): yes count is 60402, no count is 39598
Test #25:
score: 0
Accepted
time: 193ms
memory: 4200kb
input:
1000 92 92 48 22 48 36 85 61 5 34 32 92 85 77 51 80 20 21 46 66 88 60 87 24 91 37 73 49 68 82 57 43 33 8 51 9 87 88 30 87 36 55 74 9 47 79 56 28 51 91 17 43 10 91 83 8 4 31 59 27 83 20 25 40 58 57 64 58 78 6 24 19 91 13 40 23 33 39 15 24 89 9 86 15 20 28 4 82 62 6 89 71 23 51 41 6 13 27 91 66 20 3 3...
output:
NO NO NO YES YES YES NO NO NO YES YES YES YES YES NO YES NO YES YES NO NO NO YES YES YES YES YES YES YES NO NO NO YES YES YES NO YES YES YES YES NO YES YES NO YES NO NO NO YES YES YES YES NO YES YES YES NO YES NO YES NO YES NO NO NO YES NO NO NO YES YES YES YES NO NO NO NO NO NO NO YES YES YES NO YE...
result:
ok 1000 token(s): yes count is 514, no count is 486
Test #26:
score: 0
Accepted
time: 202ms
memory: 4092kb
input:
1000 1395 1395 1105 938 78 70 1391 1308 575 1100 870 761 532 359 317 510 731 1286 225 1032 417 457 143 138 1183 590 1163 684 1330 486 85 496 164 1362 1384 536 1179 634 345 556 1050 1225 96 1344 936 4 1293 1364 680 1342 1011 456 1218 252 515 7 1327 885 147 674 117 1359 232 876 240 547 529 995 1369 66...
output:
NO NO YES NO YES NO NO YES YES YES YES YES NO NO NO YES NO YES YES NO NO NO YES NO YES NO NO YES YES NO YES YES YES NO NO NO YES YES YES NO NO NO NO NO YES NO NO YES NO NO NO YES NO NO NO NO NO NO YES NO NO NO NO NO YES YES YES NO NO YES YES NO YES NO NO YES NO NO NO NO NO NO NO NO YES YES NO NO YES...
result:
ok 1000 token(s): yes count is 472, no count is 528
Test #27:
score: 0
Accepted
time: 191ms
memory: 4184kb
input:
1000 4795 4795 1309 4214 4012 1850 4558 438 94 4634 4280 776 2602 2099 3333 2225 3255 563 4312 2297 3970 37 4226 1505 3154 2093 4346 2696 1150 3480 1177 3639 4505 3028 2158 975 1656 3875 440 3655 1582 623 1481 1065 671 3689 1779 3033 4280 1446 2065 4021 3786 2148 504 435 2942 1135 1679 1604 2577 129...
output:
NO YES YES YES YES YES NO YES NO YES NO YES YES YES YES YES NO NO YES YES NO YES NO YES NO NO NO YES YES NO YES NO NO NO NO NO YES NO NO NO NO NO YES YES NO YES NO NO NO YES YES NO YES NO YES YES NO NO NO YES NO NO YES YES NO NO NO NO YES YES YES YES YES YES YES YES NO NO NO NO NO NO YES NO NO YES Y...
result:
ok 1000 token(s): yes count is 511, no count is 489
Test #28:
score: 0
Accepted
time: 205ms
memory: 4584kb
input:
1000 79 78 43 41 21 66 30 10 65 53 49 36 42 60 62 2 40 67 46 43 13 79 17 51 15 9 50 78 34 31 65 35 27 26 46 18 25 4 70 68 48 76 47 15 12 22 74 24 1 71 67 56 52 61 3 29 73 68 19 17 26 25 32 59 2 44 19 61 79 51 31 27 50 35 41 77 57 45 24 8 28 44 54 5 69 70 59 16 6 23 1 60 29 39 55 32 72 16 54 42 12 6 ...
output:
YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES NO YES NO NO YES NO NO NO NO YES YES NO NO NO YES YES NO NO YES NO NO NO NO YES NO YES YES NO YES NO NO YES NO NO YES NO YES NO YES YES YES NO NO YES NO YES NO YES YES NO YES NO NO NO YES YES NO YES YES YES NO NO YES NO YES YES NO NO YES...
result:
ok 1000 token(s): yes count is 506, no count is 494
Test #29:
score: 0
Accepted
time: 173ms
memory: 4212kb
input:
1000 564 563 286 186 170 93 368 101 6 1 131 96 209 195 87 541 243 455 536 294 107 1 33 102 405 518 274 152 52 541 133 476 304 169 476 22 282 486 541 96 77 476 105 286 386 541 48 4 1 331 157 519 274 288 169 534 149 113 562 116 21 394 558 21 541 141 264 165 220 209 167 535 324 116 228 196 264 314 62 4...
output:
YES YES NO NO NO YES YES NO YES YES YES NO YES YES YES YES NO YES YES NO YES YES NO NO YES NO NO NO NO YES YES YES NO NO NO NO NO NO YES YES NO NO YES YES NO YES NO YES NO YES NO NO YES NO YES YES NO YES NO YES NO YES YES YES YES NO YES NO YES NO NO YES YES NO YES YES NO NO YES NO YES YES NO YES NO ...
result:
ok 1000 token(s): yes count is 501, no count is 499
Test #30:
score: 0
Accepted
time: 145ms
memory: 4424kb
input:
1000 121 120 31 17 60 31 31 58 31 57 54 31 31 118 26 31 31 39 31 80 50 121 31 99 87 51 105 51 116 31 31 32 51 103 31 18 45 31 31 94 31 100 5 31 10 31 31 64 84 31 20 102 70 31 31 19 101 31 31 36 73 31 95 51 31 75 31 53 31 82 31 47 31 74 15 31 42 31 27 31 4 31 30 31 31 55 31 35 31 89 71 31 24 31 31 7 ...
output:
YES YES YES YES NO NO NO NO YES YES YES YES YES YES YES YES NO YES NO YES NO NO NO NO YES YES YES NO NO YES YES YES NO YES YES YES NO YES YES YES YES YES NO YES NO YES NO NO NO NO NO YES YES YES YES YES YES YES NO YES YES NO NO NO NO YES NO NO YES NO NO NO YES YES YES YES YES YES YES NO YES NO YES N...
result:
ok 1000 token(s): yes count is 520, no count is 480
Test #31:
score: 0
Accepted
time: 142ms
memory: 4228kb
input:
1000 1860 1860 1486 1549 1486 4 1486 1319 1486 876 1486 1346 1486 1079 1486 1448 658 1486 772 1486 1486 1569 1486 458 201 1486 845 1486 932 1511 1553 115 263 1486 306 310 115 1596 1486 1374 115 331 1486 1110 115 739 1486 77 1486 1849 1486 464 1486 139 1701 310 1804 1486 1486 1825 1629 1486 115 307 2...
output:
NO NO YES NO NO YES NO NO NO YES NO NO YES YES YES YES NO YES NO NO NO YES YES YES NO NO NO YES NO NO YES YES NO NO YES NO YES YES NO YES YES NO YES YES YES NO YES YES YES NO YES YES YES YES NO YES YES YES NO NO NO YES NO YES NO NO NO NO NO NO YES NO YES NO NO YES YES NO YES YES NO YES NO YES NO NO ...
result:
ok 1000 token(s): yes count is 504, no count is 496
Test #32:
score: -100
Time Limit Exceeded
input:
10 99999 99999 55299 76206 53426 64385 86905 10791 98284 81890 12655 7511 46654 55754 61631 27386 70022 21981 87542 20275 66909 81933 71211 38008 84522 76391 62184 73876 84201 90037 34273 33546 40421 84499 82568 84837 65007 63760 3952 93765 6975 26057 37512 92996 18729 39781 34934 32453 50660 22877 ...