Task: | Alkuluvut |
Sender: | AleksandrPolitov |
Submission time: | 2025-09-26 18:46:13 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | 58 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 17 |
#2 | ACCEPTED | 41 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#2 | ACCEPTED | 0.00 s | 2, 3 | details |
#3 | WRONG ANSWER | 0.01 s | 3 | details |
Compiler report
input/code.cpp: In function 'int32_t main()': input/code.cpp:1072:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 1072 | for (int i = 0; i < pr.size(); i++) { | ~~^~~~~~~~~~~ input/code.cpp:1071:1: warning: this 'if' clause does not guard... [-Wmisleading-indentation] 1071 | if(false) | ^~ input/code.cpp:1083:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 1083 | for(auto &w:dp) { | ^~~ input/code.cpp:1083:15: warning: unused variable 'w' [-Wunused-variable] 1083 | for(auto &w:dp) { | ^
Code
#ifdef ONPC #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #define char unsigned char #define rep(i, a, b) for(int i=a; i< (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define eb emplace_back #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define LSOne(S) ((S) & -(S)) using namespace std; // mt19937 rnd(239); mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> int sgn(T x) { return (T(0) < x) - (x < T(0)); } typedef long double T; typedef complex<T> pt; #define X real() #define Y imag() template<class T> istream& operator>> (istream& is, complex<T>& p) { T value; is >> value; p.real(value); is >> value; p.imag(value); return is; } typedef long long ll; typedef long double ld; using pi = pair<ll, ll>; using vi = vector<ll>; template <class T> using pq = priority_queue<T>; template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>; int popcnt(int x) { return __builtin_popcount(x); } int popcnt(ll x) { return __builtin_popcountll(x); } #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))) 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> 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...);} #ifdef DEBUG #define dbg(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << endl; #else #define dbg(x...) #endif template<typename S, typename T = S> void chmin(S &s, T t) {s = s < t ? s : t;} template<typename S, typename T = S> void chmax(S &s, T t) {s = s > t ? s : t;} const int INF = 1e9; // 10^9 = 1B is < 2^31-1 const ll LLINF = 4e18; // 4*10^18 is < 2^63-1 const double EPS = 1e-9; const ll MOD = 1e9+7; std::map<int, ll> dp; // bits from 0 to 9 int solve() { int n; std::cin >> n; //std::cout << "n: " << n << std::endl; int w=0; for (int i = 0; i < n; i++) { int p; std::cin >> p; //std::cout << p << " "; w|=(1<<(p)); } //std::cout << std::endl; bitset<8> bs(w); //std::cout << bs << std::endl; if(!dp.count(w)) { std::cout << "NO" << std::endl; return 0; } std::cout << "YES" << std::endl; std::cout << dp[w] << std::endl; return 0; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int TET = 1; const int N = 500'000'000; vector<int> lp; vector<int> pr; dp[2]=11; dp[3]=11111101; dp[4]=2; dp[6]=22221211; dp[7]=22212101; dp[8]=3; dp[10]=33333331; dp[11]=33333031; dp[12]=33323333; dp[13]=33333203; dp[14]=33332231; dp[15]=33332021; dp[18]=44414411; dp[19]=44441041; dp[22]=44444221; dp[23]=44442011; dp[24]=44443433; dp[25]=44440343; dp[26]=44444311; dp[27]=44443001; dp[28]=44444243; dp[29]=44444203; dp[30]=44444321; dp[31]=44442031; dp[32]=5; dp[34]=55555111; dp[35]=55555001; dp[38]=55555211; dp[39]=55550021; dp[40]=55555553; dp[41]=55555033; dp[42]=55555531; dp[43]=55555013; dp[44]=55555523; dp[45]=55553203; dp[46]=55555231; dp[47]=55552103; dp[50]=55555141; dp[51]=55554041; dp[54]=55554251; dp[55]=55542041; dp[56]=55555543; dp[57]=55555043; dp[58]=55554313; dp[59]=55554013; dp[60]=55554523; dp[61]=55550423; dp[62]=55544231; dp[63]=55542013; dp[66]=66161611; dp[67]=66666011; dp[70]=66662611; dp[71]=66660211; dp[74]=66666631; dp[75]=66666013; dp[76]=66666323; dp[77]=66666023; dp[78]=66662231; dp[79]=66632021; dp[82]=66664441; dp[83]=66660401; dp[86]=66664621; dp[87]=66664201; dp[88]=66666643; dp[89]=66663043; dp[90]=66664613; dp[91]=66663041; dp[92]=66664223; dp[93]=66640423; dp[94]=66664321; dp[95]=66643201; dp[98]=66665611; dp[99]=66665101; dp[102]=66665251; dp[103]=66665021; dp[104]=66666653; dp[105]=66666053; dp[106]=66665513; dp[107]=66651503; dp[108]=66665323; dp[109]=66665023; dp[110]=66665321; dp[111]=66650321; dp[114]=66665441; dp[115]=66660541; dp[118]=66654521; dp[119]=66552401; dp[120]=66664453; dp[121]=66654403; dp[122]=66665413; dp[123]=66654013; dp[124]=66664523; dp[125]=66652043; dp[126]=66551423; dp[127]=65543201; dp[128]=7; dp[130]=77777177; dp[131]=77777107; dp[132]=77727227; dp[133]=77777027; dp[134]=77777221; dp[135]=77772017; dp[136]=77777377; dp[137]=77777303; dp[138]=77777131; dp[139]=77770313; dp[140]=77777327; dp[141]=77773027; dp[142]=77777321; dp[143]=77773021; dp[144]=77777747; dp[145]=77777407; dp[146]=77777471; dp[147]=77774041; dp[148]=77774227; dp[149]=77772047; dp[150]=77772421; dp[151]=77744201; dp[152]=77777443; dp[153]=77774033; dp[154]=77774413; dp[155]=77741003; dp[156]=77777423; dp[157]=77774023; dp[158]=77774321; dp[159]=77743021; dp[160]=77775557; dp[161]=77775707; dp[162]=77775571; dp[163]=77770157; dp[164]=77775277; dp[165]=77750207; dp[166]=77777521; dp[167]=77752001; dp[168]=77775337; dp[169]=77770753; dp[170]=77775713; dp[171]=77757013; dp[172]=77757523; dp[173]=77775023; dp[174]=77755231; dp[175]=77753201; dp[176]=77775457; dp[177]=77757047; dp[178]=77775541; dp[179]=77754701; dp[180]=77774527; dp[181]=77552047; dp[182]=77774251; dp[183]=77550241; dp[184]=77775343; dp[185]=77770543; dp[186]=77775413; dp[187]=77754013; dp[188]=77754323; dp[189]=77754203; dp[190]=77553241; dp[191]=77542301; dp[192]=77767777; dp[193]=77776067; dp[194]=77777761; dp[195]=77776001; dp[196]=77777627; dp[197]=77770267; dp[198]=77776261; dp[199]=77772061; dp[200]=77776763; dp[201]=77776703; dp[202]=77771663; dp[203]=77776103; dp[204]=77776327; dp[205]=77762303; dp[206]=77776123; dp[207]=77661203; dp[208]=77777647; dp[209]=77766047; dp[210]=77776471; dp[211]=77764061; dp[212]=77776247; dp[213]=77762407; dp[214]=77776421; dp[215]=77726401; dp[216]=77774633; dp[217]=77776043; dp[218]=77766413; dp[219]=77764031; dp[220]=77767423; dp[221]=77664203; dp[222]=77764123; dp[223]=76642031; dp[224]=77776577; dp[225]=77776507; dp[226]=77776571; dp[227]=77767051; dp[228]=77762557; dp[229]=77762507; dp[230]=77766251; dp[231]=77765201; dp[232]=77777653; dp[233]=77766503; dp[234]=77767153; dp[235]=77665031; dp[236]=77775623; dp[237]=77765203; dp[238]=77762513; dp[239]=77653021; dp[240]=77765747; dp[241]=77765407; dp[242]=77776541; dp[243]=77765041; dp[244]=77664527; dp[245]=77650427; dp[246]=77665241; dp[247]=77654201; dp[248]=77775463; dp[249]=77665403; dp[250]=77765431; dp[251]=76654301; dp[252]=77765243; dp[253]=77650423; dp[254]=77654321; dp[255]=76540231; dp[258]=88881181; dp[259]=88888001; dp[262]=88882111; dp[263]=88888201; dp[264]=88888883; dp[265]=88883033; dp[266]=88888831; dp[267]=88888013; dp[268]=88883233; dp[269]=88880203; dp[270]=88888321; dp[271]=88881203; dp[274]=88888841; dp[275]=88880411; dp[278]=88884421; dp[279]=88844201; dp[280]=88888843; dp[281]=88884083; dp[282]=88883141; dp[283]=88883401; dp[284]=88888243; dp[285]=88884203; dp[286]=88844123; dp[287]=88843201; dp[290]=88855511; dp[291]=88885051; dp[294]=88882151; dp[295]=88882501; dp[296]=88853353; dp[297]=88885003; dp[298]=88888531; dp[299]=88885103; dp[300]=88885523; dp[301]=88835023; dp[302]=88885213; dp[303]=88853201; dp[306]=88885441; dp[307]=88854041; dp[310]=88885421; dp[311]=88544021; dp[312]=88888543; dp[313]=88880543; dp[314]=88854113; dp[315]=88850413; dp[316]=88885243; dp[317]=88845023; dp[318]=88544321; dp[319]=88542301; dp[322]=88868161; dp[323]=88886101; dp[326]=88888621; dp[327]=88862801; dp[328]=88888363; dp[329]=88886033; dp[330]=88888361; dp[331]=88866301; dp[332]=88886323; dp[333]=88863023; dp[334]=88883261; dp[335]=88661203; dp[338]=88884611; dp[339]=88864081; dp[342]=88866241; dp[343]=88864201; dp[344]=88888643; dp[345]=88866403; dp[346]=88886431; dp[347]=88864301; dp[348]=88882463; dp[349]=88662043; dp[350]=88864231; dp[351]=88643201; dp[354]=88886561; dp[355]=88886051; dp[358]=88886521; dp[359]=88862051; dp[360]=88886563; dp[361]=88865503; dp[362]=88885631; dp[363]=88665103; dp[364]=88865323; dp[365]=88860253; dp[366]=88865213; dp[367]=86625031; dp[370]=88866541; dp[371]=88864051; dp[374]=88662451; dp[375]=88654021; dp[376]=88884563; dp[377]=88665403; dp[378]=88865431; dp[379]=88653041; dp[380]=88865423; dp[381]=86654203; dp[382]=88654231; dp[383]=86542301; dp[384]=88887787; dp[385]=88887707; dp[386]=88888817; dp[387]=88880177; dp[388]=88888727; dp[389]=88888027; dp[390]=88887121; dp[391]=88877021; dp[392]=88888337; dp[393]=88883807; dp[394]=88887371; dp[395]=88887031; dp[396]=88883227; dp[397]=88883027; dp[398]=88873271; dp[399]=88872031; dp[400]=88888747; dp[401]=88887047; dp[402]=88878841; dp[403]=88887401; dp[404]=88884427; dp[405]=88842407; dp[406]=88887241; dp[407]=88847201; dp[408]=88887443; dp[409]=88884307; dp[410]=88887143; dp[411]=88770431; dp[412]=88874327; dp[413]=88870423; dp[414]=88872431; dp[415]=87732401; dp[416]=88888757; dp[417]=88888507; dp[418]=88887517; dp[419]=88877501; dp[420]=88882757; dp[421]=88885207; dp[422]=88885721; dp[423]=88775021; dp[424]=88887353; dp[425]=88887503; dp[426]=88877531; dp[427]=88870513; dp[428]=88885327; dp[429]=88875203; dp[430]=88773521; dp[431]=88752031; dp[432]=88885487; dp[433]=88870547; dp[434]=88887451; dp[435]=88874501; dp[436]=88874257; dp[437]=88752047; dp[438]=88875421; dp[439]=88754201; dp[440]=88874573; dp[441]=88857403; dp[442]=88875341; dp[443]=87754031; dp[444]=88757243; dp[445]=88745023; dp[446]=88753241; dp[448]=88888867; dp[449]=88888607; dp[450]=88887671; dp[451]=88880761; dp[452]=88886227; dp[453]=88882067; dp[454]=88876621; dp[455]=88872601; dp[456]=88888673; dp[457]=88876603; dp[458]=88887613; dp[459]=88876031; dp[460]=88886723; dp[461]=88776203; dp[462]=88876321; dp[463]=88763201; dp[464]=88884667; dp[465]=88886407; dp[466]=88886741; dp[467]=88774601; dp[468]=88876247; dp[469]=88840267; dp[470]=88876241; dp[471]=87742601; dp[472]=88886437; dp[473]=88864037; dp[474]=88776143; dp[475]=88764301; dp[476]=88874263; dp[477]=88764023; dp[478]=87764321; dp[479]=87643201; dp[480]=88886857; dp[481]=88885607; dp[482]=88877561; dp[483]=88875601; dp[484]=88886527; dp[485]=88862507; dp[486]=88765217; dp[487]=88760251; dp[488]=88887563; dp[489]=88767053; dp[490]=88876351; dp[491]=88765013; dp[492]=88876253; dp[493]=87756203; dp[494]=88765231; dp[495]=87653021; dp[496]=88875467; dp[497]=88854607; dp[498]=88875641; dp[499]=87760451; dp[500]=88765247; dp[501]=88640257; dp[502]=88765241; dp[504]=88876453; dp[505]=88765403; dp[506]=87765143; dp[507]=87654031; dp[508]=88765423; dp[509]=87652043; dp[514]=99991999; dp[515]=99991901; dp[516]=99292229; dp[517]=99992209; dp[518]=99992911; dp[519]=99929201; dp[522]=99999931; dp[523]=99999103; dp[524]=99999329; dp[525]=99992903; dp[526]=99993211; dp[527]=99932201; dp[528]=99949999; dp[529]=99994009; dp[530]=99999941; dp[531]=99999401; dp[532]=99994229; dp[533]=99944209; dp[534]=99994211; dp[535]=99994201; dp[536]=99999439; dp[537]=99999043; dp[538]=99994319; dp[539]=99949013; dp[540]=99944293; dp[541]=99944203; dp[542]=99994231; dp[543]=99942103; dp[544]=99999959; dp[545]=99999509; dp[546]=99999551; dp[547]=99995011; dp[548]=99999259; dp[549]=99995209; dp[550]=99992251; dp[551]=99992051; dp[552]=99999539; dp[553]=99995303; dp[554]=99995113; dp[555]=99955301; dp[556]=99995923; dp[557]=99959203; dp[558]=99995213; dp[559]=99930521; dp[560]=99995549; dp[561]=99954409; dp[562]=99999541; dp[563]=99995041; dp[564]=99995249; dp[565]=99942509; dp[566]=99952441; dp[567]=99545021; dp[568]=99995453; dp[569]=99955043; dp[570]=99959413; dp[571]=99954103; dp[572]=99994253; dp[573]=99950423; dp[574]=99554321; dp[575]=95541203; dp[578]=99999611; dp[579]=99996011; dp[580]=99996229; dp[581]=99962909; dp[582]=99996121; dp[583]=99962201; dp[586]=99996931; dp[587]=99993601; dp[588]=99999623; dp[589]=99990263; dp[590]=99963211; dp[591]=99632201; dp[592]=99994669; dp[593]=99996409; dp[594]=99996419; dp[595]=99994061; dp[596]=99942629; dp[597]=99640249; dp[598]=99996241; dp[599]=99964021; dp[600]=99999643; dp[601]=99966403; dp[602]=99994361; dp[603]=99964103; dp[604]=99962243; dp[605]=99644023; dp[606]=99964321; dp[607]=99641203; dp[608]=99995699; dp[609]=99996509; dp[610]=99996551; dp[611]=99965051; dp[612]=99995629; dp[613]=99965209; dp[614]=99996521; dp[615]=99925601; dp[616]=99999563; dp[617]=99995603; dp[618]=99965351; dp[619]=99655301; dp[620]=99969253; dp[621]=99960253; dp[622]=99965123; dp[623]=99652013; dp[624]=99965549; dp[625]=99654509; dp[626]=99995641; dp[627]=99960451; dp[628]=99964259; dp[629]=99645209; dp[630]=99654421; dp[631]=96550241; dp[632]=99965443; dp[633]=99655403; dp[634]=99965413; dp[635]=99654103; dp[636]=99964523; dp[637]=99642503; dp[638]=96554321; dp[640]=99979777; dp[641]=99999079; dp[642]=99999971; dp[643]=99997901; dp[644]=99992797; dp[645]=99992027; dp[646]=99999721; dp[647]=99991207; dp[648]=99999773; dp[649]=99999703; dp[650]=99997913; dp[651]=99993071; dp[652]=99992773; dp[653]=99973207; dp[654]=99992173; dp[655]=99973201; dp[656]=99997949; dp[657]=99994907; dp[658]=99997441; dp[659]=99977041; dp[660]=99999247; dp[661]=99974207; dp[662]=99992471; dp[663]=99941027; dp[664]=99999437; dp[665]=99994703; dp[666]=99977431; dp[667]=99744301; dp[668]=99997243; dp[669]=99974023; dp[670]=99974321; dp[671]=99742103; dp[672]=99997957; dp[673]=99995507; dp[674]=99999517; dp[675]=99990571; dp[676]=99999257; dp[677]=99959207; dp[678]=99972517; dp[679]=99775201; dp[680]=99997357; dp[681]=99977503; dp[682]=99997531; dp[683]=99975103; dp[684]=99997523; dp[685]=99972503; dp[686]=99771523; dp[687]=97752013; dp[688]=99999547; dp[689]=99995407; dp[690]=99995417; dp[691]=99975041; dp[692]=99975427; dp[693]=99745027; dp[694]=99974521; dp[695]=99754201; dp[696]=99997543; dp[697]=99974503; dp[698]=99975413; dp[699]=99754301; dp[700]=99757243; dp[701]=97752043; dp[702]=99751423; dp[703]=97542013; dp[704]=99999677; dp[705]=99997609; dp[706]=99999617; dp[707]=99976091; dp[708]=99997267; dp[709]=99976027; dp[710]=99996271; dp[711]=99972601; dp[712]=99997369; dp[713]=99997063; dp[714]=99996317; dp[715]=99976301; dp[716]=99976273; dp[717]=99776023; dp[718]=99976321; dp[719]=99761023; dp[720]=99997649; dp[721]=99994607; dp[722]=99977641; dp[723]=99776041; dp[724]=99994267; dp[725]=99942607; dp[726]=99976421; dp[727]=99762041; dp[728]=99996473; dp[729]=99976403; dp[730]=99776143; dp[731]=97763401; dp[732]=99962437; dp[733]=99742063; dp[734]=99764213; dp[735]=97642301; dp[736]=99996577; dp[737]=99975607; dp[738]=99996517; dp[739]=99975061; dp[740]=99996257; dp[741]=99965207; dp[742]=99776251; dp[743]=97720561; dp[744]=99977653; dp[745]=99776503; dp[746]=99976531; dp[747]=99765301; dp[748]=99976523; dp[749]=99756203; dp[750]=97765321; dp[752]=99995647; dp[753]=99950467; dp[754]=99976451; dp[755]=99765041; dp[756]=99765427; dp[757]=97604257; dp[758]=99762541; dp[759]=97645021; dp[760]=99976453; dp[761]=99760543; dp[762]=99764513; dp[763]=97654301; dp[764]=97765243; dp[766]=97654321; dp[768]=99999989; dp[769]=99999089; dp[770]=99998891; dp[771]=99991081; dp[772]=99998929; dp[773]=99992089; dp[774]=99999821; dp[775]=99998021; dp[776]=99999839; dp[777]=99990893; dp[778]=99991831; dp[779]=99988103; dp[780]=99998323; dp[781]=99992803; dp[782]=99998231; dp[783]=99983201; dp[784]=99998449; dp[785]=99988409; dp[786]=99999481; dp[787]=99994801; dp[788]=99998429; dp[789]=99984029; dp[790]=99984421; dp[791]=99884021; dp[792]=99994883; dp[793]=99988403; dp[794]=99998413; dp[795]=99984103; dp[796]=99992843; dp[797]=99942803; dp[798]=99884321; dp[799]=98842013; dp[800]=99999589; dp[801]=99990589; dp[802]=99998851; dp[803]=99998051; dp[804]=99982859; dp[805]=99885209; dp[806]=99998251; dp[807]=99985021; dp[808]=99998953; dp[809]=99980953; dp[810]=99998513; dp[811]=99980513; dp[812]=99988253; dp[813]=99882053; dp[814]=99985321; dp[815]=99853021; dp[816]=99989459; dp[817]=99985409; dp[818]=99985441; dp[819]=99858041; dp[820]=99984529; dp[821]=99852409; dp[822]=99985241; dp[823]=99850241; dp[824]=99998543; dp[825]=99950483; dp[826]=99885341; dp[827]=98854013; dp[828]=99985423; dp[829]=99854203; dp[830]=99852413; dp[831]=98543021; dp[832]=99998869; dp[833]=99998609; dp[834]=99998611; dp[835]=99986801; dp[836]=99992869; dp[837]=99982609; dp[838]=99996821; dp[839]=99982601; dp[840]=99998663; dp[841]=99998603; dp[842]=99983861; dp[843]=99886301; dp[844]=99986329; dp[845]=99986023; dp[846]=99986123; dp[847]=99862013; dp[848]=99988649; dp[849]=99886049; dp[850]=99994861; dp[851]=99984601; dp[852]=99984629; dp[853]=99860429; dp[854]=99864421; dp[855]=98862041; dp[856]=99986483; dp[857]=99880643; dp[858]=99986431; dp[859]=99864301; dp[860]=99986423; dp[861]=99842063; dp[862]=98864321; dp[864]=99995869; dp[865]=99980659; dp[866]=99995681; dp[867]=99965081; dp[868]=99886529; dp[869]=98865209; dp[870]=99986521; dp[871]=99852601; dp[872]=99996583; dp[873]=99986053; dp[874]=99986351; dp[875]=99865301; dp[876]=99885623; dp[877]=98865203; dp[878]=99865321; dp[879]=98653201; dp[880]=99965849; dp[881]=99864509; dp[882]=99868451; dp[883]=98860451; dp[884]=99856429; dp[885]=98654209; dp[886]=99864251; dp[887]=98650421; dp[888]=99985463; dp[889]=99854603; dp[890]=98864531; dp[892]=99862453; dp[893]=98654203; dp[894]=98654123; dp[896]=99999787; dp[897]=99990887; dp[898]=99999187; dp[899]=99998071; dp[900]=99999827; dp[901]=99998207; dp[902]=99987721; dp[903]=99881027; dp[904]=99998783; dp[905]=99988073; dp[906]=99993781; dp[907]=99987301; dp[908]=99993287; dp[909]=99983207; dp[910]=99887231; dp[911]=98871203; dp[912]=99999847; dp[913]=99990487; dp[914]=99998417; dp[915]=99981047; dp[916]=99988247; dp[917]=99882047; dp[918]=99984271; dp[919]=99824701; dp[920]=99998473; dp[921]=99980437; dp[922]=99984371; dp[923]=99874301; dp[924]=99887423; dp[925]=98872043; dp[926]=99874123; dp[927]=98734201; dp[928]=99999587; dp[929]=99995807; dp[930]=99988571; dp[931]=99885017; dp[932]=99998257; dp[933]=99982507; dp[934]=99985271; dp[935]=99875201; dp[936]=99998357; dp[937]=99983057; dp[938]=99885713; dp[939]=98873051; dp[940]=99985723; dp[941]=99872503; dp[942]=99875231; dp[943]=98753201; dp[944]=99987457; dp[945]=99857047; dp[946]=99985147; dp[947]=99870541; dp[948]=99985427; dp[949]=99854207; dp[950]=98854271; dp[952]=99885743; dp[953]=98854037; dp[954]=99875341; dp[955]=98754301; dp[956]=99872453; dp[957]=98752403; dp[960]=99997867; dp[961]=99987067; dp[962]=99991687; dp[963]=99978601; dp[964]=99996287; dp[965]=99968207; dp[966]=99887261; dp[967]=98876201; dp[968]=99988367; dp[969]=99887063; dp[970]=99983761; dp[971]=99876031; dp[972]=99987263; dp[973]=99872063; dp[974]=98876123; dp[976]=99987467; dp[977]=99984607; dp[978]=99984617; dp[979]=99874601; dp[980]=99886427; dp[981]=98860427; dp[982]=99876421; dp[983]=98764021; dp[984]=99986743; dp[985]=99874603; dp[986]=99874613; dp[987]=98764013; dp[988]=98872463; dp[990]=98764321; dp[992]=99989657; dp[993]=99986507; dp[994]=99886517; dp[995]=98861507; dp[996]=99986527; dp[997]=99862057; dp[998]=99875621; dp[999]=98765201; dp[1000]=99985673; dp[1001]=99876503; dp[1002]=98875613; dp[1004]=99872653; dp[1005]=98760523; dp[1006]=98752613; dp[1008]=99865847; dp[1009]=98860547; dp[1010]=99874651; dp[1011]=98706451; dp[1012]=99865427; dp[1013]=98654207; dp[1016]=98874563; dp[1018]=98765431; dp[1020]=98745623; if(false) for (int i=2; i <= N; ++i) { if (lp[i] == 0) { lp[i] = i; pr.push_back(i); } for (int j = 0; i * pr[j] <= N; ++j) { lp[i * pr[j]] = pr[j]; if (pr[j] == lp[i]) { break; } } } if(false) for (int i = 0; i < pr.size(); i++) { string p=to_string(pr[i]); int w=0; for(auto &j:p) { w|=(1<<(j-'0')); } dp[w]=pr[i]; } //std::cout << dp.size() << std::endl; for(auto &w:dp) { //std::cout << "dp[" << w.fi << "]=" << w.se << ";" << std::endl; } //return 0; cin >> TET; for (int i = 1; i <= TET; i++) { #ifdef ONPC cout << "TEST CASE#" << i << endl; #endif if (solve()) { break; } #ifdef ONPC cout << "__________________________" << endl; #endif } #ifdef ONPC cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl; #endif }
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
10 1 0 1 1 ... |
correct output |
---|
NO YES 11 YES 2 ... |
user output |
---|
NO YES 11 YES 2 ... |
Test 2
Group: 2, 3
Verdict: ACCEPTED
input |
---|
175 1 0 1 1 ... |
correct output |
---|
NO YES 11 YES 2 ... |
user output |
---|
NO YES 11 YES 2 ... |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
848 4 0 1 2 3 4 0 1 2 4 ... |
correct output |
---|
YES 10223 YES 4021 YES ... |
user output |
---|
YES 33332021 YES 44442011 YES ... |