QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#23030 | #2887. 区间矩阵乘法 | enh | TL | 3ms | 3716kb | C++14 | 523b | 2022-03-11 16:23:30 | 2022-04-30 02:14:39 |
Judging History
answer
#include <iostream>
using namespace std ;
#define int unsigned int
int n , m , a[200005] ;
signed main ( ) {
cin >> n ;
for ( int i = 1 ; i <= n ; ++ i )
cin >> a [ i ] ;
cin >> m ;
for ( int q = 1 ; q <= m ; ++ q ) {
int d , p1 , p2 , ans = 0 ;
cin >> d >> p1 >> p2 ;
for ( int i = 0 ; i < d ; ++ i ) {
for ( int j = 0 ; j < d ; ++ j ) {
for ( int k = 0 ; k < d ; ++ k )
ans += a [ p1 + d * i + j ] * a [ p2 + d * j + k ] ;
}
}
cout << ans << "\n" ;
}
return 0 ;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3716kb
input:
8 1 2 2 2 2 2 1 1 2 2 2 2 1 3 7
output:
32 2
result:
ok 2 lines
Test #2:
score: -100
Time Limit Exceeded
input:
200000 110569 155 159393 154631 169597 134901 75060 60085 189794 169502 10184 170809 170894 5697 83892 99814 97985 11604 39943 171446 77088 44463 60432 121559 54578 115592 151722 115322 147103 126168 55464 42044 181426 196809 58680 173065 136429 76030 109558 78475 161094 46875 1564 177386 108053 828...
output:
4189305368 55181820 2129409470 700818946 3501766645 1730563858 3899557935 4020833941 1896225959 3402813306 1636148212 106070907 1868972913 406568818 4117597926 65997073 3713307242 3060762232 2968862403 705700646 1131106229 4118099190 420297313 2760229439 4118078127 4042393869 1482472642 1219344853 3...