QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#303803 | #5207. Interactive Factorial Guessing | LaStataleBlue | RE | 0ms | 0kb | Python3 | 5.6kb | 2024-01-13 00:29:15 | 2024-01-13 00:29:16 |
answer
import sys
input = sys.stdin.readline
n = 1
num = 5982
maxlen = 4500
v = []
pot = [1]*(maxlen+1)
ans = set()
positions = [1601, 181, 2001, 28, 226, 1487, 6, 1, 24, 0, 10, 2, 11, 8, 3, 4, 1197, 593, 1355, 1049, 1120, 1176, 103, 122, 128, 131, 235, 153, 163, 125, 25, 7, 22, 15, 21, 12, 35, 19, 33, 9, 14, 20, 40, 26, 1442, 1447, 716, 990, 1150, 1398, 1358, 1297, 888, 1319, 1461, 1481, 845, 1162, 559, 636, 958, 1345, 1418, 806, 1459, 1139, 1219, 944, 1085, 1207, 1183, 1160, 1210, 1334, 1121, 1639, 1069, 1375, 1338, 891, 919, 1143, 712, 1341, 1161, 1169, 4427, 877, 1450, 1313, 860, 745, 1190, 694, 1284, 840, 1256, 1473, 1475, 1060, 1077, 1004, 1282, 1201, 794, 827, 368, 1409, 1467, 1293, 1027, 1289, 831, 653, 1096, 382, 803, 638, 1457, 1449, 689, 864, 703, 744, 1302, 1205, 387, 1113, 1180, 1503, 978, 1071, 909, 1021, 658, 1474, 1209, 1054, 532, 157, 174, 123, 138, 147, 89, 155, 127, 49, 112, 162, 188, 130, 146, 106, 116, 63, 124, 171, 134, 152, 178, 135, 87, 126, 111, 113, 117, 142, 167, 159, 119, 107, 192, 298, 225, 91, 165, 145, 150, 185, 101, 198, 132, 78, 121, 114, 136, 160, 258, 144, 139, 133, 207, 90, 109, 148, 115, 220, 86, 168, 85, 96, 77, 149, 1483, 1508, 1269, 1333, 1363, 902, 1036, 771, 488, 1469, 774, 1356, 1464, 953, 1017, 966, 959, 970, 1117, 598, 1163, 1129, 1889, 726, 1422, 1106, 800, 1380, 1432, 1257, 942, 665, 1550, 1324, 1301, 1266, 326, 1223, 1350, 1353, 1393, 686, 1376, 1462, 929, 1006, 219, 893, 796, 723, 920, 1057, 1666, 624, 960, 1171, 1065, 253, 896, 1403, 569, 1217, 869, 998, 634, 946, 1243, 1342, 1412, 1025, 849, 1155, 1166, 539, 968, 781, 687, 1792, 1246, 713, 839, 1440, 1116, 1388, 1179, 2376, 1108, 1081, 462, 1028, 1005, 1105, 733, 674, 1114, 1189, 1692, 1452, 1488, 1413, 1316, 853, 1138, 1255, 881, 1119, 1541, 650, 1453, 1303, 862, 852, 1280, 837, 1411, 1308, 1739, 1310, 472, 1073, 1244, 1001, 611, 1420, 937, 1494, 1242, 996, 1311, 1407, 727, 903, 1082, 666, 1378, 1547, 1234, 795, 1335, 1059, 1318, 876, 1182, 1927, 1152, 1299, 1058, 1340, 526, 1206, 1270, 1430, 707, 979, 936, 681, 501, 787, 2119, 1326, 1045, 729, 1330, 1218, 1024, 1298, 757, 838, 1429, 1465, 1038, 1264, 808, 1327, 1365, 1320, 947, 1351, 1347, 871, 865, 1247, 591, 894, 1101, 1132, 2017, 1196, 1385, 895, 955, 574, 393, 191, 1110, 644, 1458, 1239, 1265, 507, 1019, 1228, 867, 1615, 1151, 1417, 906, 1454, 973, 1225, 1000, 950, 445, 683, 649, 1485, 612, 1382, 915, 759, 1226, 1080, 1455, 1278, 1346, 1088, 1277, 1102, 626, 1997, 1104, 1125, 1186, 1292, 659, 1039, 668, 1444, 1294, 1103, 848, 1135, 1424, 783, 2237, 565, 720, 1159, 1460, 1165, 1018, 1051, 1016, 1095, 2373, 1468, 576, 1187, 1111, 730, 1543, 1576, 984, 1148, 964, 359, 1048, 822, 1419, 1170, 986, 1212, 1008, 1354, 1220, 824, 764, 945, 807, 1305, 1078, 1063, 883, 890, 1146, 879, 1014, 203, 1570, 1296, 1124, 814, 941, 1238, 440, 1700, 1386, 1188, 952, 1323, 889, 656, 1831, 1231, 1283, 810, 1089, 933, 1361, 1395, 563, 1156, 931, 582, 728, 914, 1290, 1295, 610, 928, 1252, 1317, 1032, 1061, 1383, 1437, 1348, 767, 948, 1214, 1181, 466, 1524, 1400, 1068, 1211, 1194, 1233, 994, 846, 1561, 746, 334, 708, 1040, 1445, 1428, 1276, 1230, 793, 799, 961, 820, 1050, 989, 1493, 1260, 1279, 502, 1368, 1241, 1075, 1100, 1369, 620, 2083, 1237, 773, 1172, 975, 785, 1022, 1332, 1079, 1833, 1131, 414, 1816, 912, 1415, 1236, 880, 825, 1141, 1480, 587, 1083, 981, 854, 992, 1322, 1456, 1037, 969, 718, 878, 200, 2199, 210, 1337, 938, 1107, 652, 1254, 1521, 643, 1489, 1130, 951, 1112, 1336, 1191, 1414, 1274, 770, 911, 954, 1281, 1091, 819, 1090, 1300, 1427, 700, 1268, 1164, 601, 725, 907, 1208, 1621, 884, 1020, 1204, 875, 1509, 870, 710, 1177, 892, 1436, 711, 1396, 1410, 1288, 844, 1153, 859, 512, 2539, 780, 1052, 1249, 847, 1515, 1315, 722, 1328, 1359, 1262, 1126, 863, 1084, 1127, 1786, 1381, 1240, 419, 1118, 660, 775, 1484, 1115, 698, 985, 738, 618, 1043, 1053, 651, 749, 1046, 1904, 1423, 922, 842, 475, 940, 1175, 1745, 1145, 514, 562, 211, 2180, 1275, 1390, 833, 604, 1251, 1513, 1034, 1525, 1193, 1477, 1482, 962, 908, 1373, 724, 1556, 413, 701, 1158, 581, 1007, 900, 1401, 571, 743, 762, 423, 1200, 736, 1099, 709, 1154, 2608, 976, 777, 1002, 1344, 1093, 1362, 474, 602, 1360, 476, 408, 1352, 1097, 1012, 926, 283, 956, 585, 1600, 1404, 755, 1309, 898, 1312, 980, 768, 784, 742, 1023, 1137, 921, 1329, 993, 1397, 1134, 788, 885, 943, 735, 826, 677, 1486, 1229, 830, 1222, 1261, 1168, 2122, 1476, 813, 987, 1285, 607, 932]
for i in range(1,maxlen+1):
pot[i]=pot[i-1]*10
for i in range(1,num+1):
n = n*i
n %= pot[4500]
tmp = str(n)
tmp = tmp[::-1]
tmpv = []
for j in positions:
cifra = 0
if j<len(tmp):
cifra = int(tmp[j])
tmpv.append(cifra)
v.append((tmpv,i))
x = 6*5*4*3*2*1
debug = False
def query(pos):
print('?',pos)
if debug:
res = (x//pot[pos])%10
else:
res = int(input())
return res
def calc(prof,v):
if len(v)==1:
print('!',v[0][1])
return
best = num+1
pos = -1
for i in range(maxlen):
cont = [0]*10
for j,_ in v:
tmp = 0
if i<len(j):
tmp = (int(j[i]))
cont[tmp]+=1
maxi = 0
for j in range(10):
maxi = max(maxi,cont[j])
if maxi<best:
best = maxi
pos = i
h = query(positions[pos])
for i in range(h,h+1):
tmpv = []
for j,k in v:
tmp = 0
if pos<len(j):
tmp = (int(j[pos]))
if tmp==i:
tmpv.append((j,k))
calc(prof+1,tmpv)
t = int(input())
for i in range(t):
calc(0,v)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
2