编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#21119 #1048. 1-06A. nocriz送温暖 Runtime Error 0 69 ms 2504 K C++ 17 / 730 B 自动化82-郭筠陶 2020-01-16 13:14:21
显示原始代码
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull mod = 998244353;
int main() {
    ios::sync_with_stdio(false);
    ifstream fin;
    fin.open("input");
    int n, q;
    cin >> n >> q;
    ull curNum = 1;
    vector<ull> multiples;
    multiples.push_back(1);
    for (int i = 0; i < n; i++) {
        ull tmp;
        cin >> tmp;
        curNum = curNum * tmp % mod;
        // cout<<curNum<<"\n";
        multiples.push_back(curNum);
    }
    vector<int> invs(mod + 1, 1);
    for (int i = 2; i < mod; i++) {
        invs.at(i) = (mod - mod / i) * invs.at(mod % i) % mod;
        // cout<<invs.at(i)<<"\n";
    }
    for (int i = 0; i < q; i++) {
        int l, r;
        fin >> l >> r;
        cout << (invs.at(multiples.at(l)) * multiples.at(r) % mod) << "\n";
    }
}
子任务 #1
Runtime Error
得分:0
测试点 #1
Runtime Error
得分:0
用时:2 ms
内存:404 KiB

输入文件(A1.in

5 5
365389896 37151122 798723588 59529352 304269334
2 2
4 5
2 3
3 4
5 5

答案文件(A1.out

37151122
171244932
236645991
55445263
304269334

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #2
Runtime Error
得分:0
用时:2 ms
内存:420 KiB

输入文件(A2.in

15 15
165696370 476753897 229689806 996820895 598127751 379659198 554377549 804958724 215644896 7353
<134 bytes omitted>

答案文件(A2.out

812259183
486989696
945802145
565758286
410163715
916090137
777479440
197064759
963609266
143548199

<50 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #3
Runtime Error
得分:0
用时:2 ms
内存:424 KiB

输入文件(A3.in

500 500
875859693 19297717 533567733 401117518 542067855 942549894 687071639 495756481 706319042 297
<8726 bytes omitted>

答案文件(A3.out

416681069
783464821
389635729
915396833
852827187
322964361
795736013
367058069
191319311
945823172

<4858 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #4
Runtime Error
得分:0
用时:2 ms
内存:416 KiB

输入文件(A4.in

1000 1000
453485157 936247494 264621845 889134887 643611901 819233122 269455918 554517854 916438630 
<17668 bytes omitted>

答案文件(A4.out

481893436
114188653
256055655
866518481
115927372
445439110
945938495
370915673
736335894
299245621

<9789 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #5
Runtime Error
得分:0
用时:3 ms
内存:520 KiB

输入文件(A5.in

5000 5000
946768349 138710211 991772515 390895330 281870111 571810193 822919202 883598607 169120285 
<98138 bytes omitted>

答案文件(A5.out

864985856
92100437
226580341
499360378
93125908
116831484
933548640
305899388
23514308
451996431
557
<49336 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #6
Runtime Error
得分:0
用时:5 ms
内存:708 KiB

输入文件(A6.in

20000 20000
59910458 346043205 55132948 767676760 594687540 296026148 804076263 216042891 898704108 
<423491 bytes omitted>

答案文件(A6.out

264861098
450881491
754854261
58003959
48752770
535545407
55061389
468348719
166198501
264776237
254
<197674 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #7
Runtime Error
得分:0
用时:9 ms
内存:968 KiB

输入文件(A7.in

50000 50000
10914571 746386359 717378579 224085215 984739017 267333765 956855499 541678257 451519700
<1082564 bytes omitted>

答案文件(A7.out

933637921
857402294
582354625
140335565
420947534
73718381
236706476
834562894
485573569
657491365
2
<494348 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #8
Runtime Error
得分:0
用时:7 ms
内存:984 KiB

输入文件(A8.in

50000 50000
122286549 265859588 427312049 174066036 78796680 922114383 64120931 991363404 224805463 
<1082176 bytes omitted>

答案文件(A8.out

997140837
283606682
214721539
548031555
475134263
152394271
294848899
196771768
567435648
334436465

<494194 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #9
Runtime Error
得分:0
用时:13 ms
内存:1464 KiB

输入文件(A9.in

100000 100000
157108985 615229511 21768932 970738460 197695722 367294695 642916460 248027698 6977036
<2177053 bytes omitted>

答案文件(A9.out

303168480
503863169
553764057
764316760
393488868
947406744
243417456
722363372
219982366
909099658

<988912 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault
测试点 #10
Runtime Error
得分:0
用时:24 ms
内存:2504 KiB

输入文件(A11.in

200000 200000
757148 167851001 301413357 336971125 659598369 160567226 391749388 4890852 35766291 2
<4781955 bytes omitted>

答案文件(A11.out

933983893
340699169
629640029
502347892
666587249
205473890
609674864
539513027
128544884
2
<2178111 bytes omitted>

标准错误流

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

系统信息

Killed: Segmentation fault