QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#194909 | #3853. Lines in a grid | realcomplex0# | WA | 33ms | 42744kb | C++20 | 668b | 2023-09-30 23:32:10 | 2023-09-30 23:32:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = (int)1e7 + 10;
const int MOD = (int)1e6 + 3;
int res[N];
int main(){
fastIO;
res[1] = 0;
res[2] = 6;
for(int i = 3; i < N; i ++ ){
res[i] = (res[i - 1] + ((3 * i - 2) * 1ll * (i - 1)) % MOD) % MOD;
}
int q;
cin >> q;
int l;
for(int i = 1; i <= q; i ++ ){
cin >> l;
cout << res[l] << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 33ms
memory: 42744kb
input:
10 1 2 3 4 5 6 7 8 9 10
output:
0 6 20 50 102 182 296 450 650 902
result:
wrong answer 4th lines differ - expected: '62', found: '50'