QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#594278 | #8508. DiviDuelo | ishrak26 | AC ✓ | 4ms | 3832kb | C++17 | 3.8kb | 2024-09-27 20:53:18 | 2024-09-27 20:53:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios::sync_with_stdio(false); cin.tie(0)
#define PB push_back
#define SZ 200005
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<bool> vbl;
typedef vector<string> vst;
// ordered_set
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
// template<class T> using ordered_set =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
// template<class T> using ordered_multiset =tree<T, null_type, less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
/* debugger begin */
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '"' << x << '"';}
void __print(const string &x) {cerr << '"' << x << '"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T, typename V, typename Z>
void __print(const tuple<T, V, Z> &x) {cerr << '{'; __print(get<0>(x)); cerr << ','; __print(get<1>(x)); cerr << ','; __print(get<2>(x)); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
void err(istream_iterator<string> it) {
cerr << '\n';
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << "=";
__print(a);
cerr << ' ';
err(++it, args...);
}
/* debugger end */
//const ll MOD = 1000000007;
void solve(int tt) {
ll n;
cin >> n;
bool ok = 0;
if (n == 1) {
ok = 0;
}
else {
vll fs;
int c = 0;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
fs.PB(i);
++c;
if (i != (n/i)) {
fs.PB(n/i);
++c;
}
}
}
assert(c > 1);
if (c & 1) {
ok = 0;
}
else {
if (c <= 4) {
ok = 1;
}
else {
sort(all(fs));
ll g = fs[1];
for (int i = 2; i < c; ++i) {
g = __gcd(g, fs[i]);
}
if (g > 1) {
ok = 1;
}
else {
ok = 0;
}
}
}
}
cout << (ok ? "Y" : "N") << endl;
}
int main() {
FASTIO;
int tc = 1;
// cin >> tc;
for (int tt = 1; tt <= tc; tt++)
{
solve(tt);
}
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
10
output:
Y
result:
ok "Y"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
9
output:
N
result:
ok "N"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1
output:
N
result:
ok "N"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
549755813888
output:
Y
result:
ok "Y"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
274877906944
output:
N
result:
ok "N"
Test #6:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
847288609443
output:
Y
result:
ok "Y"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3540kb
input:
282429536481
output:
N
result:
ok "N"
Test #8:
score: 0
Accepted
time: 2ms
memory: 3812kb
input:
137858491849
output:
N
result:
ok "N"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
10604499373
output:
Y
result:
ok "Y"
Test #10:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
506623120463
output:
Y
result:
ok "Y"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
10779215329
output:
N
result:
ok "N"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
41910794561
output:
Y
result:
ok "Y"
Test #13:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
64574155417
output:
Y
result:
ok "Y"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
75644818241
output:
Y
result:
ok "Y"
Test #15:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
124029899611
output:
Y
result:
ok "Y"
Test #16:
score: 0
Accepted
time: 1ms
memory: 3812kb
input:
134306640043
output:
Y
result:
ok "Y"
Test #17:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
146462570411
output:
Y
result:
ok "Y"
Test #18:
score: 0
Accepted
time: 2ms
memory: 3756kb
input:
222287988673
output:
Y
result:
ok "Y"
Test #19:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
263345887171
output:
Y
result:
ok "Y"
Test #20:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
717451682557
output:
Y
result:
ok "Y"
Test #21:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
825365364157
output:
Y
result:
ok "Y"
Test #22:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
870298842859
output:
Y
result:
ok "Y"
Test #23:
score: 0
Accepted
time: 3ms
memory: 3588kb
input:
887915259331
output:
Y
result:
ok "Y"
Test #24:
score: 0
Accepted
time: 3ms
memory: 3516kb
input:
967108197509
output:
Y
result:
ok "Y"
Test #25:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
990661375799
output:
Y
result:
ok "Y"
Test #26:
score: 0
Accepted
time: 3ms
memory: 3484kb
input:
999999999989
output:
Y
result:
ok "Y"
Test #27:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
999962000357
output:
Y
result:
ok "Y"
Test #28:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
999474022513
output:
Y
result:
ok "Y"
Test #29:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
999052035451
output:
Y
result:
ok "Y"
Test #30:
score: 0
Accepted
time: 4ms
memory: 3612kb
input:
999470040641
output:
Y
result:
ok "Y"
Test #31:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
998712349711
output:
Y
result:
ok "Y"
Test #32:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
998768376647
output:
Y
result:
ok "Y"
Test #33:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
998884311283
output:
Y
result:
ok "Y"
Test #34:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
998794254709
output:
Y
result:
ok "Y"
Test #35:
score: 0
Accepted
time: 3ms
memory: 3760kb
input:
998830303021
output:
Y
result:
ok "Y"
Test #36:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
999638023157
output:
Y
result:
ok "Y"
Test #37:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
998978227997
output:
Y
result:
ok "Y"
Test #38:
score: 0
Accepted
time: 3ms
memory: 3828kb
input:
999108034891
output:
Y
result:
ok "Y"
Test #39:
score: 0
Accepted
time: 3ms
memory: 3536kb
input:
998922289621
output:
Y
result:
ok "Y"
Test #40:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
999172169371
output:
Y
result:
ok "Y"
Test #41:
score: 0
Accepted
time: 3ms
memory: 3612kb
input:
999218015981
output:
Y
result:
ok "Y"
Test #42:
score: 0
Accepted
time: 3ms
memory: 3604kb
input:
981700934653
output:
N
result:
ok "N"
Test #43:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
942804229201
output:
N
result:
ok "N"
Test #44:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
822635014967
output:
N
result:
ok "N"
Test #45:
score: 0
Accepted
time: 4ms
memory: 3588kb
input:
954312321917
output:
N
result:
ok "N"
Test #46:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
965687001953
output:
N
result:
ok "N"
Test #47:
score: 0
Accepted
time: 4ms
memory: 3544kb
input:
907803030577
output:
N
result:
ok "N"
Test #48:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
993916557163
output:
N
result:
ok "N"
Test #49:
score: 0
Accepted
time: 3ms
memory: 3772kb
input:
844029771131
output:
N
result:
ok "N"
Test #50:
score: 0
Accepted
time: 3ms
memory: 3628kb
input:
862969367597
output:
N
result:
ok "N"
Test #51:
score: 0
Accepted
time: 3ms
memory: 3528kb
input:
768706748179
output:
N
result:
ok "N"
Test #52:
score: 0
Accepted
time: 3ms
memory: 3608kb
input:
744412255649
output:
N
result:
ok "N"
Test #53:
score: 0
Accepted
time: 4ms
memory: 3600kb
input:
877760921347
output:
N
result:
ok "N"
Test #54:
score: 0
Accepted
time: 3ms
memory: 3604kb
input:
779321766481
output:
N
result:
ok "N"
Test #55:
score: 0
Accepted
time: 3ms
memory: 3828kb
input:
786676948027
output:
N
result:
ok "N"
Test #56:
score: 0
Accepted
time: 3ms
memory: 3748kb
input:
775686765629
output:
N
result:
ok "N"
Test #57:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
971230541
output:
N
result:
ok "N"
Test #58:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
2385673
output:
N
result:
ok "N"
Test #59:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
52468711
output:
N
result:
ok "N"
Test #60:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
20358337
output:
N
result:
ok "N"
Test #61:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
9186689
output:
N
result:
ok "N"
Test #62:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
106251
output:
N
result:
ok "N"
Test #63:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
2859061
output:
N
result:
ok "N"
Test #64:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
51455519
output:
N
result:
ok "N"
Test #65:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
68063771
output:
N
result:
ok "N"
Test #66:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
44480353
output:
N
result:
ok "N"
Test #67:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
445130407
output:
N
result:
ok "N"
Test #68:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
54924301
output:
N
result:
ok "N"
Test #69:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
251377811
output:
N
result:
ok "N"
Test #70:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
11583287
output:
N
result:
ok "N"
Test #71:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
164689969
output:
N
result:
ok "N"
Test #72:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
220388553874
output:
N
result:
ok "N"
Test #73:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
337917710393
output:
N
result:
ok "N"
Test #74:
score: 0
Accepted
time: 3ms
memory: 3616kb
input:
484109724475
output:
N
result:
ok "N"
Test #75:
score: 0
Accepted
time: 3ms
memory: 3544kb
input:
494253368469
output:
N
result:
ok "N"
Test #76:
score: 0
Accepted
time: 3ms
memory: 3524kb
input:
790636814905
output:
N
result:
ok "N"
Test #77:
score: 0
Accepted
time: 3ms
memory: 3828kb
input:
593466711078
output:
N
result:
ok "N"
Test #78:
score: 0
Accepted
time: 3ms
memory: 3540kb
input:
701257784810
output:
N
result:
ok "N"
Test #79:
score: 0
Accepted
time: 3ms
memory: 3592kb
input:
821468484315
output:
N
result:
ok "N"
Test #80:
score: 0
Accepted
time: 2ms
memory: 3828kb
input:
321582188478
output:
N
result:
ok "N"
Test #81:
score: 0
Accepted
time: 3ms
memory: 3536kb
input:
623403649385
output:
N
result:
ok "N"
Test #82:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
172509105650
output:
N
result:
ok "N"
Test #83:
score: 0
Accepted
time: 3ms
memory: 3552kb
input:
579709456395
output:
N
result:
ok "N"
Test #84:
score: 0
Accepted
time: 3ms
memory: 3612kb
input:
703541153630
output:
N
result:
ok "N"
Test #85:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
371717528455
output:
N
result:
ok "N"
Test #86:
score: 0
Accepted
time: 3ms
memory: 3536kb
input:
925436174850
output:
N
result:
ok "N"
Test #87:
score: 0
Accepted
time: 2ms
memory: 3616kb
input:
441602590298
output:
N
result:
ok "N"
Test #88:
score: 0
Accepted
time: 3ms
memory: 3828kb
input:
663345923451
output:
N
result:
ok "N"
Test #89:
score: 0
Accepted
time: 3ms
memory: 3816kb
input:
662812798173
output:
N
result:
ok "N"
Test #90:
score: 0
Accepted
time: 3ms
memory: 3816kb
input:
662615302233
output:
N
result:
ok "N"
Test #91:
score: 0
Accepted
time: 3ms
memory: 3588kb
input:
663436223391
output:
N
result:
ok "N"
Test #92:
score: 0
Accepted
time: 3ms
memory: 3484kb
input:
662248872237
output:
N
result:
ok "N"
Test #93:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
662516706867
output:
N
result:
ok "N"
Test #94:
score: 0
Accepted
time: 3ms
memory: 3488kb
input:
864077614394
output:
N
result:
ok "N"
Test #95:
score: 0
Accepted
time: 3ms
memory: 3748kb
input:
977802486226
output:
N
result:
ok "N"
Test #96:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
647426786602
output:
N
result:
ok "N"
Test #97:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
901679277046
output:
N
result:
ok "N"
Test #98:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
642523777682
output:
N
result:
ok "N"
Test #99:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
871506220334
output:
N
result:
ok "N"
Test #100:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
950098378534
output:
N
result:
ok "N"
Test #101:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
660409283986
output:
N
result:
ok "N"
Test #102:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
819550638458
output:
N
result:
ok "N"
Test #103:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
846693913942
output:
N
result:
ok "N"
Test #104:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
630683996246
output:
N
result:
ok "N"
Test #105:
score: 0
Accepted
time: 3ms
memory: 3536kb
input:
698348891974
output:
N
result:
ok "N"
Test #106:
score: 0
Accepted
time: 3ms
memory: 3820kb
input:
794129725534
output:
N
result:
ok "N"
Test #107:
score: 0
Accepted
time: 3ms
memory: 3588kb
input:
731864249762
output:
N
result:
ok "N"
Test #108:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
758461160882
output:
N
result:
ok "N"
Test #109:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
200560490130
output:
N
result:
ok "N"
Test #110:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
132843110400
output:
N
result:
ok "N"
Test #111:
score: 0
Accepted
time: 3ms
memory: 3640kb
input:
700131600000
output:
N
result:
ok "N"
Test #112:
score: 0
Accepted
time: 3ms
memory: 3560kb
input:
755827200000
output:
N
result:
ok "N"
Test #113:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
3368254499
output:
Y
result:
ok "Y"
Test #114:
score: 0
Accepted
time: 2ms
memory: 3544kb
input:
338171833063
output:
Y
result:
ok "Y"
Test #115:
score: 0
Accepted
time: 2ms
memory: 3780kb
input:
182187833309
output:
Y
result:
ok "Y"
Test #116:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
207790265467
output:
Y
result:
ok "Y"
Test #117:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
101847563
output:
Y
result:
ok "Y"
Test #118:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
32187778741
output:
Y
result:
ok "Y"
Test #119:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
50284268371
output:
Y
result:
ok "Y"
Test #120:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
237176659
output:
Y
result:
ok "Y"
Test #121:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
6570725617
output:
Y
result:
ok "Y"
Test #122:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
11194326053
output:
Y
result:
ok "Y"
Test #123:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
288804781
output:
Y
result:
ok "Y"
Test #124:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
683099533943
output:
Y
result:
ok "Y"
Test #125:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
77909194511
output:
Y
result:
ok "Y"
Test #126:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
633839779
output:
Y
result:
ok "Y"
Test #127:
score: 0
Accepted
time: 1ms
memory: 3484kb
input:
49714249733
output:
Y
result:
ok "Y"
Test #128:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
60781478521
output:
N
result:
ok "N"
Test #129:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
6340459129
output:
N
result:
ok "N"
Test #130:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
582784140409
output:
N
result:
ok "N"
Test #131:
score: 0
Accepted
time: 1ms
memory: 3776kb
input:
106704795649
output:
N
result:
ok "N"
Test #132:
score: 0
Accepted
time: 2ms
memory: 3552kb
input:
364295537761
output:
N
result:
ok "N"
Test #133:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
48194738089
output:
N
result:
ok "N"
Test #134:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
534067178401
output:
N
result:
ok "N"
Test #135:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
266490315529
output:
N
result:
ok "N"
Test #136:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
41293897681
output:
N
result:
ok "N"
Test #137:
score: 0
Accepted
time: 2ms
memory: 3612kb
input:
405579196201
output:
N
result:
ok "N"
Test #138:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
7659225289
output:
N
result:
ok "N"
Test #139:
score: 0
Accepted
time: 3ms
memory: 3512kb
input:
650447089009
output:
N
result:
ok "N"
Test #140:
score: 0
Accepted
time: 3ms
memory: 3612kb
input:
856407728929
output:
N
result:
ok "N"
Test #141:
score: 0
Accepted
time: 2ms
memory: 3612kb
input:
536053872649
output:
N
result:
ok "N"
Test #142:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
48390760441
output:
N
result:
ok "N"
Extra Test:
score: 0
Extra Test Passed