QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#23932 | #2317. Hard Combinatorics | huwenbo | AC ✓ | 46ms | 20984kb | C++ | 822b | 2022-03-21 20:30:39 | 2022-04-30 04:33:54 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define maxn 1000
using namespace std;
int n,A[100005],B[100005],C[100005],D[100005];
int F[2005][2005],ans;
ll read(){
ll x=0,w=0;char ch=getchar();
while(!isdigit(ch)) w|=(ch=='-'),ch=getchar();
while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return w?-x:x;
}
void print(ll x){
if(x>=10) print(x/10);
putchar(x%10+'0');
}
int main(){
n=read();
for(int i=1;i<=n;i++){
A[i]=read(),B[i]=read(),C[i]=read(),D[i]=read();
F[maxn-A[i]][maxn-C[i]]++;
}
for(int i=0;i<=2*maxn;i++){
for(int j=0;j<=2*maxn;j++){
if(i) (F[i][j]+=F[i-1][j])%=mod;
if(j) (F[i][j]+=F[i][j-1])%=mod;
}
}
for(int i=1;i<=n;i++) (ans+=F[maxn+B[i]][maxn+D[i]])%=mod;
print(ans),puts("");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 17ms
memory: 20872kb
input:
1000 984 513 950 161 14 84 133 537 152 753 373 929 922 724 616 215 459 225 460 670 517 130 20 61 76 642 388 920 129 377 767 667 726 665 260 786 520 917 860 826 328 840 456 845 859 865 385 12 213 720 870 478 726 139 58 895 66 963 544 60 923 33 815 505 499 422 886 14 289 634 73 689 88 811 123 893 589 ...
output:
764729254
result:
ok single line: '764729254'
Test #2:
score: 0
Accepted
time: 20ms
memory: 19340kb
input:
1000 427 408 418 920 879 183 962 617 480 421 240 595 436 406 176 537 37 509 607 269 19 950 78 268 797 271 701 670 172 465 692 226 991 547 209 581 897 648 424 56 925 680 733 795 420 882 910 20 381 136 201 230 471 851 619 259 627 664 415 404 540 586 157 724 954 893 368 872 734 809 910 169 298 512 817 ...
output:
996705134
result:
ok single line: '996705134'
Test #3:
score: 0
Accepted
time: 17ms
memory: 19840kb
input:
1000 708 138 914 277 351 627 304 22 741 297 889 478 866 629 129 501 441 914 30 150 987 81 42 731 16 170 256 984 555 532 263 528 583 874 893 979 937 648 599 403 33 582 960 602 447 819 293 522 216 237 688 373 258 906 341 242 67 336 389 460 23 734 883 138 889 121 394 789 122 996 783 56 61 615 216 324 1...
output:
584878596
result:
ok single line: '584878596'
Test #4:
score: 0
Accepted
time: 19ms
memory: 19732kb
input:
1000 275 129 996 452 592 493 758 378 663 868 432 97 745 425 446 83 528 252 246 814 709 303 425 295 464 589 602 501 242 558 120 864 872 815 74 401 824 931 227 34 969 829 865 734 558 467 517 648 106 626 544 562 95 512 240 611 199 384 677 579 376 528 828 980 171 774 819 896 398 939 305 481 995 460 110 ...
output:
503693955
result:
ok single line: '503693955'
Test #5:
score: 0
Accepted
time: 14ms
memory: 20432kb
input:
1000 373 59 67 933 412 140 559 967 546 659 119 107 136 361 842 309 182 628 827 660 631 142 953 663 282 419 504 995 402 217 93 1 100 324 334 172 682 319 617 777 716 243 318 275 434 7 955 334 410 543 795 891 640 777 676 36 979 45 646 332 439 529 593 492 14 257 484 69 402 295 818 525 890 905 174 697 67...
output:
447709905
result:
ok single line: '447709905'
Test #6:
score: 0
Accepted
time: 45ms
memory: 20796kb
input:
100000 628 341 797 980 374 728 979 766 425 548 430 823 821 164 31 730 543 445 434 785 273 868 23 626 185 870 968 292 891 274 22 658 524 952 757 463 392 882 160 390 285 28 882 103 254 917 320 442 204 14 856 860 738 796 544 959 545 772 60 38 778 403 749 346 812 805 597 286 756 516 283 892 932 251 543 ...
output:
831155174
result:
ok single line: '831155174'
Test #7:
score: 0
Accepted
time: 24ms
memory: 20804kb
input:
100000 193 843 640 545 522 41 761 861 366 880 650 322 543 943 279 472 332 366 249 64 726 868 927 203 737 528 687 317 410 448 927 204 525 923 27 497 335 490 625 864 633 260 989 731 569 775 359 154 173 975 272 85 379 166 5 29 908 913 833 336 426 605 315 647 407 590 240 990 741 20 811 630 581 616 596 5...
output:
766401541
result:
ok single line: '766401541'
Test #8:
score: 0
Accepted
time: 33ms
memory: 20916kb
input:
100000 215 362 315 278 729 380 834 771 832 652 228 366 856 362 958 268 802 510 349 946 916 861 609 16 490 839 824 477 204 106 222 638 273 450 597 566 978 327 950 677 608 504 604 712 9 217 16 912 719 990 141 76 329 718 476 456 322 68 324 595 496 921 885 854 219 824 624 570 954 555 697 267 814 856 626...
output:
784333200
result:
ok single line: '784333200'
Test #9:
score: 0
Accepted
time: 46ms
memory: 20984kb
input:
100000 242 688 823 523 156 577 722 193 121 735 396 1 585 933 520 257 445 124 315 494 422 553 861 205 797 338 151 470 372 244 174 10 296 970 346 359 457 71 849 126 14 851 247 199 493 98 522 943 406 418 667 277 609 96 11 108 849 457 718 722 141 470 765 555 542 408 876 903 57 379 969 894 366 25 283 829...
output:
197629490
result:
ok single line: '197629490'
Test #10:
score: 0
Accepted
time: 31ms
memory: 20944kb
input:
100000 759 639 342 236 727 157 321 337 918 647 12 606 659 384 790 475 714 186 69 7 971 689 481 908 47 54 379 788 253 185 239 469 863 856 854 485 420 302 852 43 500 391 526 197 635 206 339 815 695 223 902 137 724 363 89 79 176 992 601 853 67 420 727 3 165 979 477 345 574 722 360 488 258 694 378 244 4...
output:
725323220
result:
ok single line: '725323220'