QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#303856#5207. Interactive Factorial GuessingLaStataleBlueRE 0ms0kbPython36.2kb2024-01-13 02:00:342024-01-13 02:00:34

Judging History

你现在查看的是最新测评结果

  • [2024-01-13 02:00:34]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-01-13 02:00:34]
  • 提交

answer

n = 1
num = 5982
maxlen = 4501
v = []

pot = [1]*maxlen
for i in range(1,maxlen):
    pot[i]=pot[i-1]*10
    
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]
succ = []
q = []

    
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))
    
#exit()

maxprof = 0
def calc(prof,v,cc):
    if len(v)<=1:
        if len(v) == 0:
            return -1
        return -v[0][1]

    #hh = [i[1] for i in v]
    #print(prof,hh,cc[0])

    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
        if best==1:
            break

    #print("divido in",positions[pos])
    tmpv = [[],[],[],[],[],[],[],[],[],[]]
    
    for j,k in v:
        tmp = 0
        if pos<len(j):
            tmp = (int(j[pos]))
        tmpv[tmp].append((j,k))
    
    succ.append([0 for i in range(10)])
    q.append(positions[pos])
    
    res = cc[0]
    cc[0]+=1
    
    for i in range(10):
        succ[res][i]=calc(prof+1,tmpv[i],cc)
      
    #print("ritorno",res)  
    return res

calc(0,v,[0])

#x = 1
debug = False
def query(pos):
    print('?',pos)
    if debug:
        res = (x//pot[pos])%10
    else:
        res = int(input())
    return res
    
t = int(input())
for i in range(t):
    #x*=(i+1)
    currpos=0
    numq=0
    while(currpos>=0):
        ans = query(q[currpos])
        currpos = succ[currpos][ans]
        numq+=1
    
    #assert(-currpos==(i+1))
    assert(numq<=10)
    print('!',-currpos)
    
    if not debug:
        ans = input()
        assert(ans=="YES")

详细

Test #1:

score: 0
Dangerous Syscalls

input:

2

output:


result: