QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#60692#3853. Lines in a gridSorting#WA 2ms3352kbC++900b2022-11-06 09:23:502022-11-06 09:23:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-06 09:23:51]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3352kb
  • [2022-11-06 09:23:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const int iu=3;
ll phi[iu+1];
const ll mod=1e6+3;
ll p0[iu+1],p1[iu+1],p2[iu+1];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	for(int i=1; i<=iu ;i++){
		phi[i]+=i;
		for(int j=i*2; j<=iu ;j+=i){
			phi[j]-=phi[i];
		}
	}
	p0[1]=p1[1]=p2[1]=1;
	for(int i=2; i<=iu ;i++){
		p0[i]=(p0[i-1]+phi[i]*2)%mod;
		p1[i]=(p1[i-1]+phi[i]*i%mod+phi[i]*i/2%mod)%mod;
		p2[i]=(p2[i-1]+phi[i]*i%mod*i%mod)%mod;
		//cout << p0[i] << ' ' << p1[i] << ' ' << p2[i] << endl;
	}
	int t;cin >> t;
	while(t--){
		ll n;cin >> n;
		if(n==1){
			cout << "0\n";
			continue;
		}
		ll ans=n;
		{
			ans=(ans-n*n%mod*p0[n/2]+4*p1[n/2]*n-4*p2[n/2])%mod;
			ans=(ans+n*n%mod*p0[n]-2*p1[n]*n+p2[n])%mod;
			ans=(ans+mod)%mod;
			
		}
		ans=(ans*2)%mod;
		cout << ans << '\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3352kb

input:

10
1 2 3 4 5 6 7 8 9 10

output:

0
6
20
0
12
999959
999901
16
999987
999861

result:

wrong answer 4th lines differ - expected: '62', found: '0'